Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions mmv1/products/workstations/WorkstationConfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ examples:
vars:
workstation_cluster_name: 'workstation-cluster'
workstation_config_name: 'workstation-config'
- name: 'workstation_config_hyperdisk'
primary_resource_id: 'default'
vars:
workstation_cluster_name: 'workstation-cluster'
workstation_config_name: 'workstation-config'
- name: 'workstation_config_hyperdisk_source_snapshot'
primary_resource_id: 'default'
vars:
workstation_cluster_name: 'workstation-cluster'
workstation_config_name: 'workstation-config'
- name: 'workstation_config_persistent_directories'
primary_resource_id: 'default'
vars:
Expand Down Expand Up @@ -427,6 +437,30 @@ properties:
description: |
Name of the snapshot to use as the source for the disk. This can be the snapshot's `self_link`, `id`, or a string in the format of `projects/{project}/global/snapshots/{snapshot}`. If set, `sizeGb` and `fsType` must be empty. Can only be updated if it has an existing value.
# TODO: Add conflicting fields once complex lists are supported.
- name: 'gceHd'
type: NestedObject
description: |
A directory to persist across workstation sessions, backed by a Compute Engine Hyperdisk Balanced High Availability disk.
properties:
- name: 'sizeGb'
type: Integer
description: |
The GB capacity of a persistent home directory. Defaults to '200'.
- name: 'sourceSnapshot'
type: String
description: |
Name of the snapshot to use as the source for the disk.
- name: 'reclaimPolicy'
type: Enum
description: |
Whether the persistent disk should be deleted when the workstation is deleted.
enum_values:
- 'DELETE'
- 'RETAIN'
- name: 'archiveTimeout'
type: String
description: |
How long to wait before converting the disk into a snapshot.
- name: 'ephemeralDirectories'
type: Array
description: |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
resource "google_compute_network" "default" {
name = "{{index $.Vars "workstation_cluster_name"}}"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
name = "{{index $.Vars "workstation_cluster_name"}}"
ip_cidr_range = "10.0.0.0/24"
region = "us-central1"
network = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "{{$.PrimaryResourceId}}" {
workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}"
network = google_compute_network.default.id
subnetwork = google_compute_subnetwork.default.id
location = "us-central1"
}

resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" {
workstation_config_id = "{{index $.Vars "workstation_config_name"}}"
workstation_cluster_id = google_workstations_workstation_cluster.{{$.PrimaryResourceId}}.workstation_cluster_id
location = "us-central1"

host {
gce_instance {
# C3 machine types require Hyperdisk storage
machine_type = "c3-standard-22"
}
}

persistent_directories {
mount_path = "/home"
gce_hd {
size_gb = 200
max_size_gb = 500
reclaim_policy = "DELETE"
archive_timeout = "3600s"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
resource "google_compute_network" "default" {
name = "{{index $.Vars "workstation_cluster_name"}}"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
name = "{{index $.Vars "workstation_cluster_name"}}"
ip_cidr_range = "10.0.0.0/24"
region = "us-central1"
network = google_compute_network.default.name
}

resource "google_compute_disk" "my_source_disk" {
name = "{{index $.Vars "workstation_config_name"}}-source-disk"
size = 10
type = "pd-ssd"
zone = "us-central1-a"
}

resource "google_compute_snapshot" "my_source_snapshot" {
name = "{{index $.Vars "workstation_config_name"}}-source-snapshot"
source_disk = google_compute_disk.my_source_disk.name
zone = "us-central1-a"
}

resource "google_workstations_workstation_cluster" "default" {
workstation_cluster_id = "{{index $.Vars "workstation_cluster_name"}}"
network = google_compute_network.default.id
subnetwork = google_compute_subnetwork.default.id
location = "us-central1"
}

resource "google_workstations_workstation_config" "{{$.PrimaryResourceId}}" {
workstation_config_id = "{{index $.Vars "workstation_config_name"}}"
workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
location = "us-central1"

host {
gce_instance {
machine_type = "c3-standard-22"
}
}

persistent_directories {
mount_path = "/home"
gce_hd {
source_snapshot = google_compute_snapshot.my_source_snapshot.id
reclaim_policy = "DELETE"
}
}
}
Loading