diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index 5cea26579c..ae746f93aa 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -685,26 +685,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } diff --git a/cluster.tf b/cluster.tf index c86070e9a0..40bd194b05 100644 --- a/cluster.tf +++ b/cluster.tf @@ -406,26 +406,26 @@ resource "google_container_node_pool" "pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } @@ -599,26 +599,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index 044dcd3e19..0275186f51 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -595,26 +595,26 @@ resource "google_container_node_pool" "pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } @@ -828,26 +828,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index f1e168e447..126f4c4e00 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -501,26 +501,26 @@ resource "google_container_node_pool" "pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } @@ -733,26 +733,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index e5e1b28b55..b5bb6e8736 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -575,26 +575,26 @@ resource "google_container_node_pool" "pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } @@ -807,26 +807,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index 3188c6a41d..b97313372e 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -481,26 +481,26 @@ resource "google_container_node_pool" "pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } @@ -712,26 +712,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 7e7e329dc5..9f572c037e 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -519,26 +519,26 @@ resource "google_container_node_pool" "pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } @@ -713,26 +713,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index 0333154d67..8a19b1b7c0 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -425,26 +425,26 @@ resource "google_container_node_pool" "pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } } @@ -618,26 +618,26 @@ resource "google_container_node_pool" "windows_pools" { } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "SURGE" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "SURGE" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "SURGE") - max_surge = lookup(each.value, "max_surge", 1) - max_unavailable = lookup(each.value, "max_unavailable", 0) + strategy = lookup(upgrade_settings.value, "strategy", "SURGE") + max_surge = lookup(upgrade_settings.value, "max_surge", 1) + max_unavailable = lookup(upgrade_settings.value, "max_unavailable", 0) } } dynamic "upgrade_settings" { - for_each = lookup(each.value, "strategy", var.strategy) == "BLUE_GREEN" ? [each.value] : [] + for_each = lookup(each.value, "strategy", "SURGE") == "BLUE_GREEN" ? [each.value] : [] content { - strategy = lookup(each.value, "strategy", "BLUE_GREEN") + strategy = lookup(upgrade_settings.value, "strategy") blue_green_settings { - node_pool_soak_duration = lookup(each.value, "node_pool_soak_duration", "3600s") + node_pool_soak_duration = lookup(upgrade_settings.value, "node_pool_soak_duration", "3600s") standard_rollout_policy { - batch_soak_duration = lookup(each.value, "batch_soak_duration", "60s") - batch_percentage = lookup(each.value, "batch_percentage", null) - batch_node_count = lookup(each.value, "batch_node_count", null) + batch_soak_duration = lookup(upgrade_settings.value, "batch_soak_duration", "60s") + batch_percentage = lookup(upgrade_settings.value, "batch_percentage", null) + batch_node_count = lookup(upgrade_settings.value, "batch_node_count", null) } } }