From c3a7760a4965e4647b6b8e45484d1f8f4d1d2e01 Mon Sep 17 00:00:00 2001 From: Brent Walker Date: Sat, 4 Feb 2023 10:57:42 -0600 Subject: [PATCH] Autopilot fix Support cluster_autoscaling configuration when using autopilot --- modules/gke-cluster/main.tf | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/gke-cluster/main.tf b/modules/gke-cluster/main.tf index 9480e42a7..0dcb17aa4 100644 --- a/modules/gke-cluster/main.tf +++ b/modules/gke-cluster/main.tf @@ -140,7 +140,17 @@ resource "google_container_cluster" "cluster" { dynamic "cluster_autoscaling" { for_each = var.cluster_autoscaling == null ? [] : [""] content { - enabled = true + enabled = var.enable_features.autopilot ? null : true + + dynamic "auto_provisioning_defaults" { + for_each = var.cluster_autoscaling.auto_provisioning_defaults != null ? [""] : [] + content { + boot_disk_kms_key = var.cluster_autoscaling.auto_provisioning_defaults.boot_disk_kms_key != null ? var.cluster_autoscaling.auto_provisioning_defaults.boot_disk_kms_key : null + image_type = var.cluster_autoscaling.auto_provisioning_defaults.image_type != null ? var.cluster_autoscaling.auto_provisioning_defaults.image_type : null + oauth_scopes = var.cluster_autoscaling.auto_provisioning_defaults.oauth_scopes != null ? var.cluster_autoscaling.auto_provisioning_defaults.oauth_scopes : null + service_account = var.cluster_autoscaling.auto_provisioning_defaults.service_account != null ? var.cluster_autoscaling.auto_provisioning_defaults.service_account : null + } + } dynamic "resource_limits" { for_each = var.cluster_autoscaling.cpu_limits != null ? [""] : [] content {