Skip to content

Commit 076e62d

Browse files
committed
Nulls compute_config.node_role_arn when node_pools is empty
Fixes the apply time error: ``` │ Error: updating EKS Cluster (ex-eks-auto-mode) compute config: operation error EKS: UpdateClusterConfig, https response error StatusCode: 400, RequestID: 93002327-da4d-47e2-8389-518b03e8aa60, InvalidParameterException: When Compute Config nodeRoleArn is not null or empty, nodePool value(s) must be provided. ```
1 parent c209337 commit 076e62d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ resource "aws_eks_cluster" "this" {
6363
content {
6464
enabled = compute_config.value.enabled
6565
node_pools = compute_config.value.enabled ? compute_config.value.node_pools : []
66-
node_role_arn = compute_config.value.node_pools != null ? try(aws_iam_role.eks_auto[0].arn, compute_config.value.node_role_arn) : null
66+
node_role_arn = compute_config.value.enabled ? (length(compute_config.value.node_pools) > 0 ? try(aws_iam_role.eks_auto[0].arn, compute_config.value.node_role_arn) : null) : null
6767
}
6868
}
6969

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ variable "compute_config" {
6666
description = "Configuration block for the cluster compute configuration"
6767
type = object({
6868
enabled = optional(bool, false)
69-
node_pools = optional(list(string))
69+
node_pools = optional(list(string), [])
7070
node_role_arn = optional(string)
7171
})
7272
default = null

0 commit comments

Comments
 (0)