Skip to content

Commit 5a0668b

Browse files
Add accelerators workstation config resource (#8490) (#15363)
Signed-off-by: Modular Magician <[email protected]>
1 parent 1211f50 commit 5a0668b

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.changelog/8490.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
workstations: added `accelerators` field to `google_workstations_workstation_config` resource(beta)
3+
```

website/docs/r/workstations_workstation_config.html.markdown

+73
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,64 @@ resource "google_workstations_workstation_config" "default" {
337337
}
338338
}
339339
```
340+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
341+
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=workstation_config_accelerators&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
342+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
343+
</a>
344+
</div>
345+
## Example Usage - Workstation Config Accelerators
346+
347+
348+
```hcl
349+
resource "google_compute_network" "default" {
350+
provider = google-beta
351+
name = "workstation-cluster"
352+
auto_create_subnetworks = false
353+
}
354+
355+
resource "google_compute_subnetwork" "default" {
356+
provider = google-beta
357+
name = "workstation-cluster"
358+
ip_cidr_range = "10.0.0.0/24"
359+
region = "us-central1"
360+
network = google_compute_network.default.name
361+
}
362+
363+
resource "google_workstations_workstation_cluster" "default" {
364+
provider = google-beta
365+
workstation_cluster_id = "workstation-cluster"
366+
network = google_compute_network.default.id
367+
subnetwork = google_compute_subnetwork.default.id
368+
location = "us-central1"
369+
370+
labels = {
371+
"label" = "key"
372+
}
373+
374+
annotations = {
375+
label-one = "value-one"
376+
}
377+
}
378+
379+
resource "google_workstations_workstation_config" "default" {
380+
provider = google-beta
381+
workstation_config_id = "workstation-config"
382+
workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
383+
location = "us-central1"
384+
385+
host {
386+
gce_instance {
387+
machine_type = "n1-standard-2"
388+
boot_disk_size_gb = 35
389+
disable_public_ip_addresses = true
390+
accelerators {
391+
type = "nvidia-tesla-p100"
392+
count = "1"
393+
}
394+
}
395+
}
396+
}
397+
```
340398
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
341399
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.jpy.wang%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=workstation_config_encryption_key&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
342400
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
@@ -540,6 +598,11 @@ The following arguments are supported:
540598
A set of Compute Engine Confidential VM instance options.
541599
Structure is [documented below](#nested_confidential_instance_config).
542600

601+
* `accelerators` -
602+
(Optional)
603+
An accelerator card attached to the instance.
604+
Structure is [documented below](#nested_accelerators).
605+
543606

544607
<a name="nested_shielded_instance_config"></a>The `shielded_instance_config` block supports:
545608

@@ -561,6 +624,16 @@ The following arguments are supported:
561624
(Optional)
562625
Whether the instance has confidential compute enabled.
563626

627+
<a name="nested_accelerators"></a>The `accelerators` block supports:
628+
629+
* `type` -
630+
(Required)
631+
Type of accelerator resource to attach to the instance, for example, "nvidia-tesla-p100".
632+
633+
* `count` -
634+
(Required)
635+
Number of accelerator cards exposed to the instance.
636+
564637
<a name="nested_persistent_directories"></a>The `persistent_directories` block supports:
565638

566639
* `mount_path` -

0 commit comments

Comments
 (0)