From 49d5e21a4bd010a1b033263b3f1a61b8b886c41b Mon Sep 17 00:00:00 2001 From: Daniel Marzini <44803752+danielmarzini@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:30:54 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20csi-driver,=20logging=20and=20monitoring?= =?UTF-8?q?=20default=20values=20when=20autopilot=20=E2=80=A6=20(#883)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix csi-driver, logging and monitoring default values when autopilot is used Co-authored-by: Ludovico Magnocavallo --- default-versions.tf | 4 ++++ modules/gke-cluster/main.tf | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/default-versions.tf b/default-versions.tf index b2e7c1c3a..ab57f9e93 100644 --- a/default-versions.tf +++ b/default-versions.tf @@ -23,6 +23,10 @@ terraform { source = "hashicorp/google-beta" version = ">= 4.36.0" # tftest } + # used in modules + archive = { + source = "hashicorp/archive" + } # used in fast local = { source = "hashicorp/local" diff --git a/modules/gke-cluster/main.tf b/modules/gke-cluster/main.tf index 99bcf9569..9981d9b4e 100644 --- a/modules/gke-cluster/main.tf +++ b/modules/gke-cluster/main.tf @@ -79,7 +79,11 @@ resource "google_container_cluster" "cluster" { ) } gce_persistent_disk_csi_driver_config { - enabled = var.enable_addons.gce_persistent_disk_csi_driver + enabled = ( + var.enable_features.autopilot + ? true + : var.enable_addons.gce_persistent_disk_csi_driver + ) } dynamic "gcp_filestore_csi_driver_config" { for_each = !var.enable_features.autopilot ? [""] : [] @@ -169,7 +173,7 @@ resource "google_container_cluster" "cluster" { } dynamic "logging_config" { - for_each = var.logging_config != null ? [""] : [] + for_each = var.logging_config != null && !var.enable_features.autopilot ? [""] : [] content { enable_components = var.logging_config } @@ -234,7 +238,7 @@ resource "google_container_cluster" "cluster" { } dynamic "monitoring_config" { - for_each = var.monitoring_config != null ? [""] : [] + for_each = var.monitoring_config != null && !var.enable_features.autopilot ? [""] : [] content { enable_components = var.monitoring_config }