Skip to content

Commit

Permalink
fix: Not to iterate over remote_access object in dynamic block (#1743)
Browse files Browse the repository at this point in the history
  • Loading branch information
knight42 authored Jan 7, 2022
1 parent 3c66863 commit 86b3c33
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions examples/eks_managed_node_group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ module "eks" {
}
]

remote_access = {
ec2_ssh_key = "my-ssh-key"
}

update_config = {
max_unavailable_percentage = 50 # or set `max_unavailable`
}
Expand Down
6 changes: 3 additions & 3 deletions modules/eks-managed-node-group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ resource "aws_eks_node_group" "this" {
}

dynamic "remote_access" {
for_each = var.remote_access
for_each = length(var.remote_access) > 0 ? [var.remote_access] : []
content {
ec2_ssh_key = lookup(remote_access.value, "ec2_ssh_key", null)
source_security_group_ids = lookup(remote_access.value, "source_security_group_ids", [])
ec2_ssh_key = try(remote_access.value.ec2_ssh_key, null)
source_security_group_ids = try(remote_access.value.source_security_group_ids, [])
}
}

Expand Down

0 comments on commit 86b3c33

Please sign in to comment.