fix: Not to iterate over remote_access object in dynamic block (#1743)

This commit is contained in:
Jian Zeng
2022-01-07 20:52:47 +08:00
committed by GitHub
parent 3c6686379d
commit 86b3c339a7
2 changed files with 7 additions and 3 deletions

View File

@@ -173,6 +173,10 @@ module "eks" {
}
]
remote_access = {
ec2_ssh_key = "my-ssh-key"
}
update_config = {
max_unavailable_percentage = 50 # or set `max_unavailable`
}

View File

@@ -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, [])
}
}