Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow updating persistent disk size and disk type in cloud workstations #9305

Merged
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
3 changes: 3 additions & 0 deletions .changelog/13043.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
workstations: added update support to `persistent_directories.gce_pd.size_gb` and `persistent_directories.gce_pd.disk_type` in `google_workstations_workstation_config` resource (beta)
```
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,6 @@ Please refer to the field 'effective_labels' for all of the labels present on th
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
Description: `The type of the persistent disk for the home directory. Defaults to 'pd-standard'.`,
},
"fs_type": {
Expand All @@ -523,7 +522,6 @@ Please refer to the field 'effective_labels' for all of the labels present on th
Type: schema.TypeInt,
Computed: true,
Optional: true,
ForceNew: true,
Description: `The GB capacity of a persistent home directory for each workstation created with this configuration. Must be empty if 'sourceSnapshot' is set.
Valid values are '10', '50', '100', '200', '500', or '1000'. Defaults to '200'. If less than '200' GB, the 'diskType' must be 'pd-balanced' or 'pd-ssd'.`,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ func TestAccWorkstationsWorkstationConfig_persistentDirectories(t *testing.T) {
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "labels", "terraform_labels"},
},
{
Config: testAccWorkstationsWorkstationConfig_persistentDirectoriesUpdated(context),
},
{
ResourceName: "google_workstations_workstation_cluster.default",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"etag", "labels", "terraform_labels"},
},
},
})
}
Expand Down Expand Up @@ -225,6 +234,56 @@ resource "google_workstations_workstation_config" "default" {
`, context)
}

func testAccWorkstationsWorkstationConfig_persistentDirectoriesUpdated(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_compute_network" "default" {
provider = google-beta
name = "tf-test-workstation-cluster%{random_suffix}"
auto_create_subnetworks = false
}

resource "google_compute_subnetwork" "default" {
provider = google-beta
name = "tf-test-workstation-cluster%{random_suffix}"
ip_cidr_range = "10.0.0.0/24"
region = "us-central1"
network = google_compute_network.default.name
}

resource "google_workstations_workstation_cluster" "default" {
provider = google-beta
workstation_cluster_id = "tf-test-workstation-cluster%{random_suffix}"
network = google_compute_network.default.id
subnetwork = google_compute_subnetwork.default.id
location = "us-central1"

labels = {
foo = "bar"
}
}

resource "google_workstations_workstation_config" "default" {
provider = google-beta
workstation_config_id = "tf-test-workstation-config%{random_suffix}"
workstation_cluster_id = google_workstations_workstation_cluster.default.workstation_cluster_id
location = "us-central1"

persistent_directories {
mount_path = "/home"

gce_pd {
disk_type = "pd-standard"
size_gb = 200
}
}

labels = {
foo = "bar"
}
}
`, context)
}

func TestAccWorkstationsWorkstationConfig_ephemeralDirectories(t *testing.T) {
t.Parallel()

Expand Down