Skip to content

Commit 89e7c33

Browse files
Add NetworkConfig to TPU v2 QueuedResource (#12482) (#21426)
[upstream:7babab6dbe1faa3f859d33ceed7e35bad51ba82c] Signed-off-by: Modular Magician <[email protected]>
1 parent 9f6a405 commit 89e7c33

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

.changelog/12482.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
tpuv2: added `network_config` field to `google_tpu_v2_queued_resource` resource
3+
```

website/docs/r/tpu_v2_queued_resource.html.markdown

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,54 @@ resource "google_tpu_v2_queued_resource" "qr" {
5454
}
5555
}
5656
```
57+
## Example Usage - Tpu V2 Queued Resource Full
58+
59+
60+
```hcl
61+
resource "google_tpu_v2_queued_resource" "qr" {
62+
provider = google-beta
63+
64+
name = "test-qr"
65+
zone = "us-central1-c"
66+
project = "my-project-name"
67+
68+
tpu {
69+
node_spec {
70+
parent = "projects/my-project-name/locations/us-central1-c"
71+
node_id = "test-tpu"
72+
node {
73+
runtime_version = "tpu-vm-tf-2.13.0"
74+
accelerator_type = "v2-8"
75+
description = "Text description of the TPU."
76+
77+
network_config {
78+
can_ip_forward = true
79+
enable_external_ips = true
80+
network = google_compute_network.network.id
81+
subnetwork = google_compute_subnetwork.subnet.id
82+
queue_count = 32
83+
}
84+
}
85+
}
86+
}
87+
}
88+
89+
resource "google_compute_subnetwork" "subnet" {
90+
provider = google-beta
91+
92+
name = "tpu-subnet"
93+
ip_cidr_range = "10.0.0.0/16"
94+
region = "us-central1"
95+
network = google_compute_network.network.id
96+
}
97+
98+
resource "google_compute_network" "network" {
99+
provider = google-beta
100+
101+
name = "tpu-net"
102+
auto_create_subnetworks = false
103+
}
104+
```
57105

58106
## Argument Reference
59107

@@ -119,6 +167,38 @@ The following arguments are supported:
119167
(Optional)
120168
Text description of the TPU.
121169

170+
* `network_config` -
171+
(Optional)
172+
Network configurations for the TPU node.
173+
Structure is [documented below](#nested_tpu_node_spec_node_spec_node_network_config).
174+
175+
176+
<a name="nested_tpu_node_spec_node_spec_node_network_config"></a>The `network_config` block supports:
177+
178+
* `network` -
179+
(Optional)
180+
The name of the network for the TPU node. It must be a preexisting Google Compute Engine
181+
network. If none is provided, "default" will be used.
182+
183+
* `subnetwork` -
184+
(Optional)
185+
The name of the subnetwork for the TPU node. It must be a preexisting Google Compute
186+
Engine subnetwork. If none is provided, "default" will be used.
187+
188+
* `enable_external_ips` -
189+
(Optional)
190+
Indicates that external IP addresses would be associated with the TPU workers. If set to
191+
false, the specified subnetwork or network should have Private Google Access enabled.
192+
193+
* `can_ip_forward` -
194+
(Optional)
195+
Allows the TPU node to send and receive packets with non-matching destination or source
196+
IPs. This is required if you plan to use the TPU workers to forward routes.
197+
198+
* `queue_count` -
199+
(Optional)
200+
Specifies networking queue count for TPU VM instance's network interface.
201+
122202
## Attributes Reference
123203

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

0 commit comments

Comments
 (0)