diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index f485dcb247..e19ac99e24 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -631,6 +631,7 @@ resource "google_container_node_pool" "windows_pools" { content { min_node_count = lookup(autoscaling.value, "min_count", 1) max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } diff --git a/cluster.tf b/cluster.tf index c9574e9218..4203d1ff18 100644 --- a/cluster.tf +++ b/cluster.tf @@ -331,8 +331,9 @@ resource "google_container_node_pool" "pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } @@ -483,8 +484,9 @@ resource "google_container_node_pool" "windows_pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } diff --git a/modules/beta-private-cluster-update-variant/cluster.tf b/modules/beta-private-cluster-update-variant/cluster.tf index daad8f3295..8d58b266d9 100644 --- a/modules/beta-private-cluster-update-variant/cluster.tf +++ b/modules/beta-private-cluster-update-variant/cluster.tf @@ -549,8 +549,9 @@ resource "google_container_node_pool" "pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } @@ -754,8 +755,9 @@ resource "google_container_node_pool" "windows_pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } diff --git a/modules/beta-private-cluster/cluster.tf b/modules/beta-private-cluster/cluster.tf index de0f41ec0f..c8ed13dcf6 100644 --- a/modules/beta-private-cluster/cluster.tf +++ b/modules/beta-private-cluster/cluster.tf @@ -458,8 +458,9 @@ resource "google_container_node_pool" "pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } @@ -662,8 +663,9 @@ resource "google_container_node_pool" "windows_pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } diff --git a/modules/beta-public-cluster-update-variant/cluster.tf b/modules/beta-public-cluster-update-variant/cluster.tf index f464068cff..d541a20f52 100644 --- a/modules/beta-public-cluster-update-variant/cluster.tf +++ b/modules/beta-public-cluster-update-variant/cluster.tf @@ -530,8 +530,9 @@ resource "google_container_node_pool" "pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } @@ -735,8 +736,9 @@ resource "google_container_node_pool" "windows_pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } diff --git a/modules/beta-public-cluster/cluster.tf b/modules/beta-public-cluster/cluster.tf index 3cc7330640..48303233f4 100644 --- a/modules/beta-public-cluster/cluster.tf +++ b/modules/beta-public-cluster/cluster.tf @@ -439,8 +439,9 @@ resource "google_container_node_pool" "pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } @@ -643,8 +644,9 @@ resource "google_container_node_pool" "windows_pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } diff --git a/modules/private-cluster-update-variant/cluster.tf b/modules/private-cluster-update-variant/cluster.tf index 7cf9af2da6..441b2ecab8 100644 --- a/modules/private-cluster-update-variant/cluster.tf +++ b/modules/private-cluster-update-variant/cluster.tf @@ -435,8 +435,9 @@ resource "google_container_node_pool" "pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } @@ -588,8 +589,9 @@ resource "google_container_node_pool" "windows_pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } diff --git a/modules/private-cluster/cluster.tf b/modules/private-cluster/cluster.tf index 4c7955a9dd..11b136a594 100644 --- a/modules/private-cluster/cluster.tf +++ b/modules/private-cluster/cluster.tf @@ -344,8 +344,9 @@ resource "google_container_node_pool" "pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } } @@ -496,8 +497,9 @@ resource "google_container_node_pool" "windows_pools" { dynamic "autoscaling" { for_each = lookup(each.value, "autoscaling", true) ? [each.value] : [] content { - min_node_count = lookup(autoscaling.value, "min_count", 1) - max_node_count = lookup(autoscaling.value, "max_count", 100) + min_node_count = lookup(autoscaling.value, "min_count", 1) + max_node_count = lookup(autoscaling.value, "max_count", 100) + location_policy = lookup(autoscaling.value, "location_policy", (lookup(autoscaling.value, "spot", false) || lookup(autoscaling.value, "preemptible", false) ? "ANY" : "BALANCED")) } }