terraform-provider-google/website/docs/r/tpu_node.html.markdown
The Magician 59b08fb422 Add TPU Tensorflow datasource (#3325)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-03-27 16:26:07 -07:00

6.2 KiB

layout page_title sidebar_current description
google Google: google_tpu_node docs-google-tpu-node A Cloud TPU instance.

google_tpu_node

A Cloud TPU instance.

To get more information about Node, see:

## Example Usage - Tpu Node Basic
data "google_tpu_tensorflow_versions" "available" { }

resource "google_tpu_node" "tpu" {
	name           = "test-tpu"
	zone           = "us-central1-b"

	accelerator_type   = "v3-8"
	tensorflow_version = "${data.google_tpu_tensorflow_versions.available.versions[0]}"
	cidr_block         = "10.2.0.0/29"
}
## Example Usage - Tpu Node Full
resource "google_compute_network" "tpu_network" {
	name               = "test-tpu-network"
	auto_create_subnetworks = false
}

data "google_tpu_tensorflow_versions" "available" { }

resource "google_tpu_node" "tpu" {
	name               = "test-tpu"
	zone               = "us-central1-b"

	accelerator_type   = "v3-8"

	cidr_block         = "10.3.0.0/29"
	tensorflow_version = "${data.google_tpu_tensorflow_versions.available.versions[0]}"

	description = "Terraform Google Provider test TPU"
	network = "${google_compute_network.tpu_network.name}"

	labels = {
		foo = "bar"
	}

	scheduling_config {
		preemptible = true
	}
}

Argument Reference

The following arguments are supported:

  • name - (Required) The immutable name of the TPU.

  • accelerator_type - (Required) The type of hardware accelerators associated with this node.

  • tensorflow_version - (Required) The version of Tensorflow running in the Node.

  • cidr_block - (Required) 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.

  • zone - (Required) The GCP location for the TPU.


  • description - (Optional) The user-supplied description of the TPU. Maximum of 512 characters.

  • network - (Optional) 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.

  • scheduling_config - (Optional) Sets the scheduling options for this TPU instance. Structure is documented below.

  • labels - (Optional) Resource labels to represent user provided metadata.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The scheduling_config block supports:

  • preemptible - (Optional) Defines whether the TPU instance is preemptible.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • service_account - 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.

  • network_endpoints - 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. Structure is documented below.

The network_endpoints block contains:

  • ip_address - The IP address of this network endpoint.

  • port - The port of this network endpoint.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 15 minutes.
  • update - Default is 15 minutes.
  • delete - Default is 15 minutes.

Import

Node can be imported using any of these accepted formats:

$ terraform import google_tpu_node.default projects/{{project}}/locations/{{zone}}/nodes/{{name}}
$ terraform import google_tpu_node.default {{project}}/{{zone}}/{{name}}
$ terraform import google_tpu_node.default {{name}}

-> If you're importing a resource with beta features, make sure to include -provider=google-beta as an argument so that Terraform uses the correct provider to import your resource.