From cbd77748b604e547409a00e2a44449d6e1fb827c Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Fri, 21 Feb 2025 15:15:48 -0800 Subject: [PATCH 1/2] Supports passing in compute_config = null The logic around enabling Auto Mode is based on the value never being null, so use `nullable = false` in the variable definition so that a null value will be interpreted as nn empty map (the default value). Fixes https://github.com/terraform-aws-modules/terraform-aws-eks/issues/3307 --- variables.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/variables.tf b/variables.tf index 855c2133ec..91ad761ec6 100644 --- a/variables.tf +++ b/variables.tf @@ -47,6 +47,7 @@ variable "authentication_mode" { variable "cluster_compute_config" { description = "Configuration block for the cluster compute configuration" type = any + nullable = false default = {} } From c91f8a6e32bdcf246fe68719acd10779cfa0ec85 Mon Sep 17 00:00:00 2001 From: Loren Gordon Date: Fri, 21 Feb 2025 15:18:35 -0800 Subject: [PATCH 2/2] Nulls the compute_config entirely when auto mode is disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API will return an error if compute_config.enabled is set to false, when every other required option for auto mode is also not provided. ``` │ Error: creating EKS Cluster (test-minimum-inputs-kuneic): operation error EKS: CreateCluster, https response error StatusCode: 400, RequestID: 573c664d-68c6-463c-b117-ba12722ebe96, InvalidParameterException: For EKS Auto Mode, please ensure that all required configs, including computeConfig, kubernetesNetworkConfig, and blockStorage are all either fully enabled or fully disabled. ``` Seems like an odd API choice, but that's how it works. Fixes https://github.com/terraform-aws-modules/terraform-aws-eks/issues/3307 --- main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 18933422f5..562e9d9495 100644 --- a/main.tf +++ b/main.tf @@ -53,7 +53,7 @@ resource "aws_eks_cluster" "this" { } dynamic "compute_config" { - for_each = length(var.cluster_compute_config) > 0 ? [var.cluster_compute_config] : [] + for_each = local.auto_mode_enabled ? [var.cluster_compute_config] : [] content { enabled = local.auto_mode_enabled