|
| 1 | +resource "google_tags_tag_key" "tag_key1" { |
| 2 | + parent = "organizations/0123456789-${local.name_suffix}" |
| 3 | + short_name = "keyname-${local.name_suffix}" |
| 4 | +} |
| 5 | + |
| 6 | +resource "google_tags_tag_value" "tag_value1" { |
| 7 | + parent = google_tags_tag_key.tag_key1.id |
| 8 | + short_name = "valuename-${local.name_suffix}" |
| 9 | +} |
| 10 | + |
| 11 | +resource "google_compute_network" "default" { |
| 12 | + name = "workstation-cluster-${local.name_suffix}" |
| 13 | + auto_create_subnetworks = false |
| 14 | +} |
| 15 | + |
| 16 | +resource "google_compute_subnetwork" "default" { |
| 17 | + name = "workstation-cluster-${local.name_suffix}" |
| 18 | + ip_cidr_range = "10.0.0.0/24" |
| 19 | + region = "us-central1" |
| 20 | + network = google_compute_network.default.name |
| 21 | +} |
| 22 | + |
| 23 | +resource "google_compute_disk" "my_source_disk" { |
| 24 | + name = "workstation-config-${local.name_suffix}-source-disk" |
| 25 | + size = 10 |
| 26 | + type = "pd-ssd" |
| 27 | + zone = "us-central1-a" |
| 28 | +} |
| 29 | + |
| 30 | +resource "google_compute_snapshot" "my_source_snapshot" { |
| 31 | + name = "workstation-config-${local.name_suffix}-source-snapshot" |
| 32 | + source_disk = google_compute_disk.my_source_disk.name |
| 33 | + zone = "us-central1-a" |
| 34 | +} |
| 35 | + |
| 36 | +resource "google_workstations_workstation_cluster" "default" { |
| 37 | + workstation_cluster_id = "workstation-cluster-${local.name_suffix}" |
| 38 | + network = google_compute_network.default.id |
| 39 | + subnetwork = google_compute_subnetwork.default.id |
| 40 | + location = "us-central1" |
| 41 | +} |
| 42 | + |
| 43 | +resource "google_workstations_workstation_config" "default" { |
| 44 | + workstation_config_id = "workstation-config-${local.name_suffix}" |
| 45 | + workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id |
| 46 | + location = "us-central1" |
| 47 | + |
| 48 | + host { |
| 49 | + gce_instance { |
| 50 | + machine_type = "c3-standard-22" |
| 51 | + boot_disk_size_gb = 35 |
| 52 | + disable_public_ip_addresses = true |
| 53 | + vm_tags = { |
| 54 | + (google_tags_tag_key.tag_key1.id) = google_tags_tag_value.tag_value1.id |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + persistent_directories { |
| 60 | + mount_path = "/home" |
| 61 | + gce_hd { |
| 62 | + source_snapshot = google_compute_snapshot.my_source_snapshot.id |
| 63 | + reclaim_policy = "DELETE" |
| 64 | + archive_timeout = "3600s" |
| 65 | + } |
| 66 | + } |
| 67 | +} |
0 commit comments