From 52e25ab2c929777fddada40c0c0a03ac03ae75ec Mon Sep 17 00:00:00 2001 From: Jeremy Olmsted-Thompson Date: Tue, 31 Jan 2023 14:40:04 -0800 Subject: [PATCH] fix: support custom service account for autopilot (#1550) --- autogen/main/cluster.tf.tmpl | 2 +- modules/beta-autopilot-private-cluster/cluster.tf | 2 +- modules/beta-autopilot-public-cluster/cluster.tf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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