blob: 38d371e4e96c74fd63ef47f9696da9a26ca3ea8b [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Cloud TPU"
description: |-
A Cloud TPU instance.
---
# google\_tpu\_node
A Cloud TPU instance.
To get more information about Node, see:
* [API documentation](https://cloud.google.com/tpu/docs/reference/rest/v1/projects.locations.nodes)
* How-to Guides
* [Official Documentation](https://cloud.google.com/tpu/docs/)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=tpu_node_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Tpu Node Basic
```hcl
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
```hcl
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]
description = "Terraform Google Provider test TPU"
use_service_networking = true
network = google_service_networking_connection.private_service_connection.network
labels = {
foo = "bar"
}
scheduling_config {
preemptible = true
}
}
resource "google_compute_network" "network" {
name = "tpu-node-network"
}
resource "google_compute_global_address" "service_range" {
name = "my-global-address"
purpose = "VPC_PEERING"
address_type = "INTERNAL"
prefix_length = 16
network = google_compute_network.network.id
}
resource "google_service_networking_connection" "private_service_connection" {
network = google_compute_network.network.id
service = "servicenetworking.googleapis.com"
reserved_peering_ranges = [google_compute_global_address.service_range.name]
}
```
## 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.
- - -
* `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.
* `cidr_block` -
(Optional)
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.
* `use_service_networking` -
(Optional)
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.
* `scheduling_config` -
(Optional)
Sets the scheduling options for this TPU instance.
Structure is [documented below](#nested_scheduling_config).
* `labels` -
(Optional)
Resource labels to represent user provided metadata.
**Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
Please refer to the field `effective_labels` for all of the labels present on the resource.
* `zone` -
(Optional)
The GCP location for the TPU. If it is not provided, the provider zone is used.
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
<a name="nested_scheduling_config"></a>The `scheduling_config` block supports:
* `preemptible` -
(Required)
Defines whether the TPU instance is preemptible.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{zone}}/nodes/{{name}}`
* `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](#nested_network_endpoints).
* `terraform_labels` -
The combination of labels configured directly on the resource
and default labels configured on the provider.
* `effective_labels` -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Terraform, other clients and services.
<a name="nested_network_endpoints"></a>The `network_endpoints` block contains:
* `ip_address` -
(Output)
The IP address of this network endpoint.
* `port` -
(Output)
The port of this network endpoint.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
Node can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{zone}}/nodes/{{name}}`
* `{{project}}/{{zone}}/{{name}}`
* `{{zone}}/{{name}}`
* `{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Node using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{zone}}/nodes/{{name}}"
to = google_tpu_node.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Node can be imported using one of the formats above. For example:
```
$ 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 {{zone}}/{{name}}
$ terraform import google_tpu_node.default {{name}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).