Skip to content

Commit

Permalink
Fix csi-driver, logging and monitoring default values when autopilot … (
Browse files Browse the repository at this point in the history
#883)

* Fix csi-driver, logging and monitoring default values when autopilot is used
Co-authored-by: Ludovico Magnocavallo <ludomagno@google.com>
  • Loading branch information
danielmarzini committed Oct 14, 2022
1 parent 1c24e92 commit 49d5e21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions default-versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 7 additions & 3 deletions modules/gke-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? [""] : []
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 49d5e21

Please sign in to comment.