Skip to content

Commit

Permalink
feat!: align keepers with ForceNew: true fields
Browse files Browse the repository at this point in the history
Will cause node pools to be re-created on update, unless remote state
of the `random_id` resources is manually modified to reflect the new keepers.

Fixes terraform-google-modules#1695
  • Loading branch information
lauraseidler committed Oct 11, 2023
1 parent ba22351 commit 67d9764
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 88 deletions.
25 changes: 3 additions & 22 deletions autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,12 @@ locals {
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
"enable_secure_boot",
"enable_integrity_monitoring",
"local_ssd_count",
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
Expand All @@ -582,6 +584,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
]
}

Expand All @@ -598,18 +601,6 @@ resource "random_id" "name" {
local.force_node_pool_recreation_resources,
[for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")]
),
{
labels = join(",",
sort(
concat(
keys(local.node_pools_labels["all"]),
values(local.node_pools_labels["all"]),
keys(local.node_pools_labels[each.value["name"]]),
values(local.node_pools_labels[each.value["name"]])
)
)
)
},
{
taints = join(",",
sort(
Expand Down Expand Up @@ -643,16 +634,6 @@ resource "random_id" "name" {
)
)
)
},
{
tags = join(",",
sort(
concat(
local.node_pools_tags["all"],
local.node_pools_tags[each.value["name"]]
)
)
)
}
)
}
Expand Down
25 changes: 3 additions & 22 deletions modules/beta-private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -484,10 +484,12 @@ locals {
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
"enable_secure_boot",
"enable_integrity_monitoring",
"local_ssd_count",
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
Expand All @@ -497,6 +499,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
]
}

Expand All @@ -513,18 +516,6 @@ resource "random_id" "name" {
local.force_node_pool_recreation_resources,
[for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")]
),
{
labels = join(",",
sort(
concat(
keys(local.node_pools_labels["all"]),
values(local.node_pools_labels["all"]),
keys(local.node_pools_labels[each.value["name"]]),
values(local.node_pools_labels[each.value["name"]])
)
)
)
},
{
taints = join(",",
sort(
Expand Down Expand Up @@ -558,16 +549,6 @@ resource "random_id" "name" {
)
)
)
},
{
tags = join(",",
sort(
concat(
local.node_pools_tags["all"],
local.node_pools_tags[each.value["name"]]
)
)
)
}
)
}
Expand Down
25 changes: 3 additions & 22 deletions modules/beta-public-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,12 @@ locals {
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
"enable_secure_boot",
"enable_integrity_monitoring",
"local_ssd_count",
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
Expand All @@ -478,6 +480,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
]
}

Expand All @@ -494,18 +497,6 @@ resource "random_id" "name" {
local.force_node_pool_recreation_resources,
[for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")]
),
{
labels = join(",",
sort(
concat(
keys(local.node_pools_labels["all"]),
values(local.node_pools_labels["all"]),
keys(local.node_pools_labels[each.value["name"]]),
values(local.node_pools_labels[each.value["name"]])
)
)
)
},
{
taints = join(",",
sort(
Expand Down Expand Up @@ -539,16 +530,6 @@ resource "random_id" "name" {
)
)
)
},
{
tags = join(",",
sort(
concat(
local.node_pools_tags["all"],
local.node_pools_tags[each.value["name"]]
)
)
)
}
)
}
Expand Down
25 changes: 3 additions & 22 deletions modules/private-cluster-update-variant/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,12 @@ locals {
"disk_type",
"accelerator_count",
"accelerator_type",
"gpu_partition_size",
"enable_secure_boot",
"enable_integrity_monitoring",
"local_ssd_count",
"machine_type",
"placement_policy",
"max_pods_per_node",
"min_cpu_platform",
"pod_range",
Expand All @@ -424,6 +426,7 @@ locals {
"enable_gcfs",
"enable_gvnic",
"enable_secure_boot",
"boot_disk_kms_key",
]
}

Expand All @@ -440,18 +443,6 @@ resource "random_id" "name" {
local.force_node_pool_recreation_resources,
[for keeper in local.force_node_pool_recreation_resources : lookup(each.value, keeper, "")]
),
{
labels = join(",",
sort(
concat(
keys(local.node_pools_labels["all"]),
values(local.node_pools_labels["all"]),
keys(local.node_pools_labels[each.value["name"]]),
values(local.node_pools_labels[each.value["name"]])
)
)
)
},
{
taints = join(",",
sort(
Expand Down Expand Up @@ -485,16 +476,6 @@ resource "random_id" "name" {
)
)
)
},
{
tags = join(",",
sort(
concat(
local.node_pools_tags["all"],
local.node_pools_tags[each.value["name"]]
)
)
)
}
)
}
Expand Down

0 comments on commit 67d9764

Please sign in to comment.