fix: Avoid trying to attach the node role when Auto Mode nodepools are not specified (#3239)

This commit is contained in:
Bryant Biggs
2024-12-12 07:14:15 -06:00
committed by GitHub
parent 5583604ffa
commit ce34f1db3f

View File

@@ -58,7 +58,7 @@ resource "aws_eks_cluster" "this" {
content {
enabled = try(compute_config.value.enabled, null)
node_pools = local.auto_mode_enabled ? try(compute_config.value.node_pools, []) : null
node_role_arn = local.auto_mode_enabled ? try(compute_config.value.node_role_arn, aws_iam_role.eks_auto[0].arn, null) : null
node_role_arn = local.auto_mode_enabled && length(try(compute_config.value.node_pools, [])) > 0 ? try(compute_config.value.node_role_arn, aws_iam_role.eks_auto[0].arn, null) : null
}
}