-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid for_each argument on aws_default_tags #2281
Comments
I am getting the same issue. I have tried v18.30.0, v18.30.1, and v18.30.2. Going back to v18.29.1 fixes the issue for me. |
the use of default tags added in v18.30 was unfortunately found to have introduced some issues and we will be correcting this in v19 since its removal is a breaking change. Apologies for any headache experienced by this |
This issue has been resolved in version 19.0.0 🎉 |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Getting the error while running the EKS cluster creation
│ Error: Invalid for_each argument
│
│ on .terraform/modules/eks/main.tf line 71, in resource "aws_ec2_tag" "cluster_primary_security_group":
│ 71: for_each = { for k, v in merge(var.tags, var.cluster_tags, data.aws_default_tags.current.tags) :
│ 72: k => v if local.create && k != "Name" && var.create_cluster_primary_security_group_tags
│ 73: }
│ ├────────────────
│ │ data.aws_default_tags.current.tags is a map of string, known only after apply
│ │ local.create is true
│ │ var.cluster_tags is map of string with 3 elements
│ │ var.create_cluster_primary_security_group_tags is true
│ │ var.tags is map of string with 3 elements
The "for_each" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of this resource.
This is happening because of
data "aws_default_tags" "current" {}
.There is no proper documentation to fix this error, any suggestions ?
The text was updated successfully, but these errors were encountered: