Skip to content

Commit c3d6c5b

Browse files
committed
fix: Not to iterate over remote_access object in dynamic block
1 parent 3c66863 commit c3d6c5b

File tree

2 files changed

+7
-3
lines changed
  • examples/eks_managed_node_group
  • modules/eks-managed-node-group

2 files changed

+7
-3
lines changed

examples/eks_managed_node_group/main.tf

+4
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ module "eks" {
173173
}
174174
]
175175

176+
remote_access = {
177+
ec2_ssh_key = "my-ssh-key"
178+
}
179+
176180
update_config = {
177181
max_unavailable_percentage = 50 # or set `max_unavailable`
178182
}

modules/eks-managed-node-group/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,10 @@ resource "aws_eks_node_group" "this" {
295295
}
296296

297297
dynamic "remote_access" {
298-
for_each = var.remote_access
298+
for_each = length(var.remote_access) > 0 ? [var.remote_access] : []
299299
content {
300-
ec2_ssh_key = lookup(remote_access.value, "ec2_ssh_key", null)
301-
source_security_group_ids = lookup(remote_access.value, "source_security_group_ids", [])
300+
ec2_ssh_key = try(remote_access.value.ec2_ssh_key, null)
301+
source_security_group_ids = try(remote_access.value.source_security_group_ids, [])
302302
}
303303
}
304304

0 commit comments

Comments
 (0)