-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Using terraform <1.6.0, aws_ec2_tag
with dynamic tag *values* results in for_each error about unknown *keys*
#3118
Comments
lorengordon
added a commit
to lorengordon/terraform-aws-eks
that referenced
this issue
Aug 9, 2024
…wn *keys* Fixes terraform-aws-modules#3118 Related terraform-aws-modules#2760 Related terraform-aws-modules#2681 Related terraform-aws-modules#2337
3 tasks
bryantbiggs
pushed a commit
that referenced
this issue
Aug 9, 2024
antonbabenko
pushed a commit
that referenced
this issue
Aug 9, 2024
This issue has been resolved in version 20.22.1 🎉 |
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
When using Terraform <1.6.0, a tag value that includes a dynamically interpolated function, like
timestamp()
, will result in an error of the form:Example setup for tags. We add an expiration to all resources, sorta like the below, but a little different to avoid a persistent diff. This does reproduce though:
Actually, if you search for
aws_ec2_tag
, there are lots of issues all saying the same thing. Difference here is that I know why it is occurring! :DValid forms of this error pertain only to keys. But this is a value. Dynamic values should be fine in any for_each expression, so obviously the error is bogus, and represents a bug in Terraform. And this is actually fixed in Terraform 1.6.0 and newer, but we're still pinned to 1.5.7 for now due to the license change.
Still, I was curious, why was this happening at all, and can we modify the module to avoid the bug? Looking at the module code:
terraform-aws-eks/main.tf
Lines 126 to 128 in 5fe865e
I couldn't understand why the check was there for
v != null
. And since this is happening for values, it made me suspicious. So I removed the check. And the error went away. Hurrah!I wanted to understand why the check was there, so I looked into the blame for the file, and saw the check was introduced in PR 2250. I see @antonbabenko commented in the review, suggesting the check, but no particular explanation. Just maybe a sense that
null
would be invalid anyway, so might as well remove it? I can't think of any valid reason a tag value would benull
. So to me it just seems like user error. Since the check causes problems (for many folks, going off the number of issues in the search), I'm hoping a PR would be accepted to remove the check.The text was updated successfully, but these errors were encountered: