From 4dfa66a23f2c75010622203d710a30fc32af9dcf Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Tue, 26 Nov 2024 08:31:07 -0500 Subject: [PATCH 1/3] allow updating disk_type, disk_size_gb, machine_type, enable_gcfs in place Signed-off-by: drfaust92 --- autogen/main/cluster.tf.tmpl | 4 ---- modules/beta-private-cluster-update-variant/cluster.tf | 4 ---- modules/beta-public-cluster-update-variant/cluster.tf | 4 ---- modules/private-cluster-update-variant/cluster.tf | 4 ---- 4 files changed, 16 deletions(-) diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 1b2ef3ecf7..3b88ffa2c7 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -718,8 +718,6 @@ resource "google_container_cluster" "primary" { {% if update_variant %} locals { force_node_pool_recreation_resources = [ - "disk_size_gb", - "disk_type", "accelerator_count", "accelerator_type", "gpu_partition_size", @@ -732,7 +730,6 @@ locals { {% if beta_cluster %} "local_ssd_ephemeral_count", {% endif %} - "machine_type", "placement_policy", "max_pods_per_node", "min_cpu_platform", @@ -740,7 +737,6 @@ locals { "preemptible", "spot", "service_account", - "enable_gcfs", "enable_gvnic", "boot_disk_kms_key", "queued_provisioning", diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 8633a8fe15..d09352915b 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -610,8 +610,6 @@ resource "google_container_cluster" "primary" { *****************************************/ locals { force_node_pool_recreation_resources = [ - "disk_size_gb", - "disk_type", "accelerator_count", "accelerator_type", "gpu_partition_size", @@ -622,7 +620,6 @@ locals { "enable_integrity_monitoring", "local_ssd_count", "local_ssd_ephemeral_count", - "machine_type", "placement_policy", "max_pods_per_node", "min_cpu_platform", @@ -630,7 +627,6 @@ locals { "preemptible", "spot", "service_account", - "enable_gcfs", "enable_gvnic", "boot_disk_kms_key", "queued_provisioning", diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 2497ab7714..471865dc73 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -589,8 +589,6 @@ resource "google_container_cluster" "primary" { *****************************************/ locals { force_node_pool_recreation_resources = [ - "disk_size_gb", - "disk_type", "accelerator_count", "accelerator_type", "gpu_partition_size", @@ -601,7 +599,6 @@ locals { "enable_integrity_monitoring", "local_ssd_count", "local_ssd_ephemeral_count", - "machine_type", "placement_policy", "max_pods_per_node", "min_cpu_platform", @@ -609,7 +606,6 @@ locals { "preemptible", "spot", "service_account", - "enable_gcfs", "enable_gvnic", "boot_disk_kms_key", "queued_provisioning", diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 7577f9eadb..27b169bd36 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -562,8 +562,6 @@ resource "google_container_cluster" "primary" { *****************************************/ locals { force_node_pool_recreation_resources = [ - "disk_size_gb", - "disk_type", "accelerator_count", "accelerator_type", "gpu_partition_size", @@ -573,7 +571,6 @@ locals { "enable_secure_boot", "enable_integrity_monitoring", "local_ssd_count", - "machine_type", "placement_policy", "max_pods_per_node", "min_cpu_platform", @@ -581,7 +578,6 @@ locals { "preemptible", "spot", "service_account", - "enable_gcfs", "enable_gvnic", "boot_disk_kms_key", "queued_provisioning", From 775de5494343960ae90f4ace71e56726fbb821f6 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Tue, 26 Nov 2024 20:20:48 -0500 Subject: [PATCH 2/3] allow updating disk_type, disk_size_gb, machine_type, enable_gcfs in place Signed-off-by: drfaust92 --- docs/upgrading_to_v35.0.md | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/docs/upgrading_to_v35.0.md b/docs/upgrading_to_v35.0.md index 12852dd8b8..b825683856 100644 --- a/docs/upgrading_to_v35.0.md +++ b/docs/upgrading_to_v35.0.md @@ -6,3 +6,47 @@ The Terraform Kubernetes Engine Module now requires version 6 of the Google Clou ### Private Cluster Sub-Modules Endpoint Output The private cluster sub-modules now return the cluster's private endpoint for the `endpoint` output when the `enable_private_endpoint` argument is `true`, regardless of the `deploy_using_private_endpoint` argument value. + +### Update variant random ID keepers updated + +The v35.0 release updates the keepers for the update variant modules. This will force a recreation of the nodepools. + +To avoid this, it is possible to edit the remote state of the `random_id` resource to add the new attributes. + +1. Perform a `terraform plan` as normal, identifying the `random_id` resource(s) changing and the new/removed attributes +```tf + ~ keepers = { # forces replacement + - "disk_type" = "" -> null + - "disk_size_gb" = "" -> null + - "machine_type" = "" -> null + - "enable_gcfs" = "" -> null + # (19 unchanged elements hidden) + } + # (2 unchanged attributes hidden) + } +``` +2. Pull the remote state locally: `terraform state pull > default.tfstate` +3. Back up the original remote state: `cp default.tfstate original.tfstate` +4. Edit the `random_id` resource(s) to add/remove the attributes from the `terraform plan` step +```diff +"attributes": { + "b64_std": "pool-02-vb4=", + "b64_url": "pool-02-vb4", + "byte_length": 2, + "dec": "pool-02-48574", + "hex": "pool-02-bdbe", + "id": "vb4", + "keepers": { + ... + "taints": "", +- "disk_size_gb": "", +- "enable_gcfs": "", +- "machine_type": "", +- "disk_type": "", + }, + "prefix": "pool-02-" + } +``` +1. Bump the serial number at the top +2. Push the modified state to the remote `terraform state push default.tfstate` +3. Confirm the `random_id` resource(s) no longer changes (or the corresponding `nodepool`) in a `terraform plan` From 8d927798a88219a2da0fc3afe76cbb7de250c012 Mon Sep 17 00:00:00 2001 From: drfaust92 Date: Tue, 26 Nov 2024 20:21:08 -0500 Subject: [PATCH 3/3] allow updating disk_type, disk_size_gb, machine_type, enable_gcfs in place Signed-off-by: drfaust92 --- docs/upgrading_to_v35.0.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/upgrading_to_v35.0.md b/docs/upgrading_to_v35.0.md index b825683856..bd55288bb4 100644 --- a/docs/upgrading_to_v35.0.md +++ b/docs/upgrading_to_v35.0.md @@ -7,7 +7,7 @@ The Terraform Kubernetes Engine Module now requires version 6 of the Google Clou ### Private Cluster Sub-Modules Endpoint Output The private cluster sub-modules now return the cluster's private endpoint for the `endpoint` output when the `enable_private_endpoint` argument is `true`, regardless of the `deploy_using_private_endpoint` argument value. -### Update variant random ID keepers updated +## Update variant random ID keepers updated The v35.0 release updates the keepers for the update variant modules. This will force a recreation of the nodepools.