-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Interpolated config keys #2042
Comments
This should work:
Can you test that and report back? Thanks! |
Used Terraform v0.5.2:
Plan output:
EC2 tags: It's odd it also cleared the value. But main thing is it does not interpolate the quoted key, which is what I originally tried I thought might work. |
Hi @progrium! Sorry for the long silence here. In the mean time since you filed this, Terraform's support for dynamic maps got a little better. Although the syntax is non-ideal, it's now possible (since 0.7) to express what you wanted to express here using the tags = "${map(var.name, "bar")}" It's also possible to use the We know that the syntax is non-ideal here and plan to address it in future as part of some holistic language improvements, though we've not yet got all the details figured out. Since the requested feature is now supported -- albeit in a non-ideal way for now -- I'm going to close this as part of our effort to close out some older, neglected issues. Once we have some more concrete plans for evolving the configuration language we'll open some new issues/PRs for those. |
@apparentlymart - Sorry to dig up an old subject. On the topic of For example, this can't work:
because it's not a map and that's not how the
I imagine it's just not possible? Thanks! |
@artburkart that's a good question... my first thought would've been what you did in your first example here, and indeed that is how it would ideally work but probably there is some silly detail that prevents it from working today. If you're willing to share some more details in a new issue (including the exact error message you got when you tried your first example) I'm happy to look a little deeper and try to understand why this isn't working today and if there's a relatively-easy fix. |
Thought I'd mention another option, if you needed to combine a number of tags with interpolated keys,
|
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. |
This seems like a not-very-common issue, but when it comes to AWS tags it is... we do a lot of tags where the key is dynamic. I can't figure out a way to do this in Terraform. Any ideas on a proposal to allow this?
The text was updated successfully, but these errors were encountered: