From ee27b755bb2b2e99841fb7dd059a0afa02db94a0 Mon Sep 17 00:00:00 2001 From: William Yardley Date: Mon, 23 Sep 2024 15:01:01 -0700 Subject: [PATCH] fix: allow null `enable_gcfs` setting in defined nodepools Fixes #2100 This basically replicates the fixes from #2093, #2095, but at the scope of implicitly defined nodepools. --- autogen/main/cluster.tf.tmpl | 2 +- cluster.tf | 4 ++-- modules/beta-private-cluster-update-variant/cluster.tf | 4 ++-- modules/beta-private-cluster/cluster.tf | 4 ++-- modules/beta-public-cluster-update-variant/cluster.tf | 4 ++-- modules/beta-public-cluster/cluster.tf | 4 ++-- modules/private-cluster-update-variant/cluster.tf | 4 ++-- modules/private-cluster/cluster.tf | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 52d6ef05d2..3732440c05 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -887,7 +887,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null ) !=null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } diff --git a/cluster.tf b/cluster.tf index 27cd0cebb0..5ac63fc65e 100644 --- a/cluster.tf +++ b/cluster.tf @@ -593,7 +593,7 @@ resource "google_container_node_pool" "pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } @@ -875,7 +875,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 7f6916b96e..1a42cbd6f6 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -760,7 +760,7 @@ resource "google_container_node_pool" "pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } @@ -1056,7 +1056,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index ef77e7808d..4b5bd2455c 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -678,7 +678,7 @@ resource "google_container_node_pool" "pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } @@ -973,7 +973,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index bafcacdd12..c4d50aca18 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -739,7 +739,7 @@ resource "google_container_node_pool" "pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } @@ -1035,7 +1035,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index 2c362c4263..a36f5d95e3 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -657,7 +657,7 @@ resource "google_container_node_pool" "pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } @@ -952,7 +952,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index e3a1a52263..a3b8ed94d1 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -696,7 +696,7 @@ resource "google_container_node_pool" "pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } @@ -979,7 +979,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index c6cf074c54..17724dcd64 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -614,7 +614,7 @@ resource "google_container_node_pool" "pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value } @@ -896,7 +896,7 @@ resource "google_container_node_pool" "windows_pools" { min_cpu_platform = lookup(each.value, "min_cpu_platform", "") enable_confidential_storage = lookup(each.value, "enable_confidential_storage", false) dynamic "gcfs_config" { - for_each = lookup(each.value, "enable_gcfs", false) ? [true] : [false] + for_each = lookup(each.value, "enable_gcfs", null) != null ? [each.value.enable_gcfs] : [] content { enabled = gcfs_config.value }