diff --git a/autogen/main/cluster.tf.tmpl b/autogen/main/cluster.tf.tmpl index ff2fbab41..375ebe91c 100644 --- a/autogen/main/cluster.tf.tmpl +++ b/autogen/main/cluster.tf.tmpl @@ -162,7 +162,7 @@ resource "google_container_cluster" "primary" { {% if autopilot_cluster == true %} cluster_autoscaling { dynamic "auto_provisioning_defaults" { - for_each = var.create_service_account ? [1] : [] + for_each = (var.create_service_account || var.service_account != "") ? [1] : [] content { service_account = local.service_account diff --git a/modules/beta-autopilot-private-cluster/cluster.tf b/modules/beta-autopilot-private-cluster/cluster.tf index 738af9bf9..e9dcf947c 100644 --- a/modules/beta-autopilot-private-cluster/cluster.tf +++ b/modules/beta-autopilot-private-cluster/cluster.tf @@ -71,7 +71,7 @@ resource "google_container_cluster" "primary" { cluster_autoscaling { dynamic "auto_provisioning_defaults" { - for_each = var.create_service_account ? [1] : [] + for_each = (var.create_service_account || var.service_account != "") ? [1] : [] content { service_account = local.service_account diff --git a/modules/beta-autopilot-public-cluster/cluster.tf b/modules/beta-autopilot-public-cluster/cluster.tf index 880bb7a45..a75edce9f 100644 --- a/modules/beta-autopilot-public-cluster/cluster.tf +++ b/modules/beta-autopilot-public-cluster/cluster.tf @@ -71,7 +71,7 @@ resource "google_container_cluster" "primary" { cluster_autoscaling { dynamic "auto_provisioning_defaults" { - for_each = var.create_service_account ? [1] : [] + for_each = (var.create_service_account || var.service_account != "") ? [1] : [] content { service_account = local.service_account