Google Cloud TPU Node

This page shows how to write Terraform for Cloud TPU Node and write them securely.

google_tpu_node (Terraform)

The Node in Cloud TPU can be configured in Terraform with the resource name google_tpu_node. The following sections describe 1 example of how to use the resource and its parameters.

Example Usage from GitHub
resource "google_tpu_node" "this" {
  accelerator_type   = var.accelerator_type
  cidr_block         = var.cidr_block
  description        = var.description
  labels             = var.labels
  name               =

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


The type of hardware accelerators associated with this node.

The CIDR block that the TPU node will use when selecting an IP address. This CIDR block must be a /29 block; the Compute Engine networks API forbids a smaller block, and using a larger block would be wasteful (a node can only consume one IP address). Errors will occur if the CIDR block has already been used for a currently existing TPU node, the CIDR block conflicts with any subnetworks in the user's provided network, or the provided network is peered with another network that is using that CIDR block.

The user-supplied description of the TPU. Maximum of 512 characters.

  • id optional computed - string
  • labels optional - map from string to string

Resource labels to represent user provided metadata.

The immutable name of the TPU.

The name of a network to peer the TPU node to. It must be a preexisting Compute Engine network inside of the project on which this API has been activated. If none is provided, "default" will be used.

The network endpoints where TPU workers can be accessed and sent work. It is recommended that Tensorflow clients of the node first reach out to the first (index 0) entry.

The service account used to run the tensor flow services within the node. To share resources, including Google Cloud Storage data, with the Tensorflow job running in the Node, this account must have permissions to that data.

The version of Tensorflow running in the Node.

Whether the VPC peering for the node is set up through Service Networking API. The VPC Peering should be set up before provisioning the node. If this field is set, cidr_block field should not be specified. If the network that you want to peer the TPU Node to is a Shared VPC network, the node must be created with this this field enabled.

  • zone optional computed - string

The GCP location for the TPU. If it is not provided, the provider zone is used.

Explanation in Terraform Registry

A Cloud TPU instance. To get more information about Node, see:

Frequently asked questions

What is Google Cloud TPU Node?

Google Cloud TPU Node is a resource for Cloud TPU of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Cloud TPU Node?

For Terraform, the niveklabs/google source code example is useful. See the Terraform Example section for further details.


Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.