diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 1f318514b5..fcbcda1b6e 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -896,19 +896,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( diff --git a/cluster.tf b/cluster.tf index 6c695c9878..55340c0654 100644 --- a/cluster.tf +++ b/cluster.tf @@ -605,19 +605,11 @@ resource "google_container_node_pool" "pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( @@ -895,19 +887,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index f44eb34efd..e49be78e7b 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -772,19 +772,11 @@ resource "google_container_node_pool" "pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( @@ -1076,19 +1068,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index 4e9dffc719..6b0a0f6d23 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -690,19 +690,11 @@ resource "google_container_node_pool" "pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( @@ -993,19 +985,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index 34de7d349d..e8f4922aed 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -751,19 +751,11 @@ resource "google_container_node_pool" "pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( @@ -1055,19 +1047,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index c92ace51b1..7d1f847af2 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -669,19 +669,11 @@ resource "google_container_node_pool" "pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( @@ -972,19 +964,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 02646aed2d..f176f183b6 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -708,19 +708,11 @@ resource "google_container_node_pool" "pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( @@ -999,19 +991,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index f621c95f11..f8a5fbc855 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -626,19 +626,11 @@ resource "google_container_node_pool" "pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge( @@ -916,19 +908,11 @@ resource "google_container_node_pool" "windows_pools" { } } dynamic "reservation_affinity" { - for_each = lookup(each.value, "queued_provisioning", false) ? [{ - consume_reservation_type = "NO_RESERVATION" - key = null - values = null - }] : [{ - consume_reservation_type = lookup(each.value, "consume_reservation_type", null) - key = lookup(each.value, "reservation_affinity_key", null) - values = lookup(each.value, "reservation_affinity_values", null) - }] + for_each = lookup(each.value, "queued_provisioning", false) || lookup(each.value, "consume_reservation_type", "") != "" ? [each.value] : [] content { - consume_reservation_type = reservation_affinity.value.consume_reservation_type - key = reservation_affinity.value.key - values = reservation_affinity.value.values == null ? null : split(",", reservation_affinity.value.values) + consume_reservation_type = lookup(reservation_affinity.value, "queued_provisioning", false) ? "NO_RESERVATION" : lookup(reservation_affinity.value, "consume_reservation_type", null) + key = lookup(reservation_affinity.value, "reservation_affinity_key", null) + values = lookup(reservation_affinity.value, "reservation_affinity_values", null) == null ? null : split(",", lookup(reservation_affinity.value, "reservation_affinity_values", null)) } } labels = merge(