Closed jcarlson closed 3 years ago
This issue likely has to do with the way the for_each
value is set on the dynamic "load_balancer"
block. Changing that block to something like the following does work:
dynamic "load_balancer" {
for_each = {
red = aws_lb_target_group.red.arn
blue = aws_lb_target_group.blue.arn
}
content {
container_name = "app"
container_port = 80
target_group_arn = load_balancer.value
}
}
However, if the issue is that the for_each
keys are not known at plan-time, then the error message doesn't accurately reflect that issue.
Hi folks 👋 Is this still a problem on recent versions of Terraform CLI? There have been various fixes to how dynamic
blocks operate over Terraform CLI releases, especially around known versus unknown map keys. This type of issue is not likely resolvable in the Terraform AWS Provider code itself, due to the nature of the issue, but if it is still reproducible we are happy to help ensure there is a covering Terraform CLI issue created.
Closing due to lack of response. As mentioned above, if you have a reproduction case using recent versions of Terraform CLI, please submit an issue upstream. 👍
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/jcarlson/88ff26db037953c54f9aeac36d9b7c25
Expected Behavior
Terraform should create an ECS Service associated with two Target Groups
Actual Behavior
Terraform planned to create an ECS Service associated with one Target Group, then failed when the plan changed.
Steps to Reproduce
terraform apply