From 743dba1d30e12195aa7d4e684717d2ea91a1834b Mon Sep 17 00:00:00 2001 From: Miguel Harmant Date: Fri, 13 Dec 2024 14:49:37 -0500 Subject: [PATCH] dynamic blocks for eks auto config --- modules/eks/cluster.tf | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/eks/cluster.tf b/modules/eks/cluster.tf index fbddc9af..ef8a8feb 100644 --- a/modules/eks/cluster.tf +++ b/modules/eks/cluster.tf @@ -54,10 +54,13 @@ resource "aws_eks_cluster" "this" { } - compute_config { - enabled = var.eks.auto_mode_enabled - node_pools = try(var.eks.compute_config.value.node_pools, null) - node_role_arn = try(aws_iam_role.eks_auto_node_role[0].arn, null) + dynamic "compute_config" { + for_each = var.eks.auto_mode_enabled ? [1] : [] + content { + enabled = var.eks.auto_mode_enabled + node_pools = try(var.eks.compute_config.value.node_pools, null) + node_role_arn = try(aws_iam_role.eks_auto_node_role[0].arn, null) + } } kubernetes_network_config { @@ -68,12 +71,14 @@ resource "aws_eks_cluster" "this" { } } - storage_config { - block_storage { - enabled = var.eks.auto_mode_enabled + dynamic "storage_config" { + for_each = var.eks.auto_mode_enabled ? [1] : [] + content { + block_storage { + enabled = var.eks.auto_mode_enabled + } } } - upgrade_policy { support_type = "EXTENDED" }