-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Passing List as Template Variables #9368
Comments
Try pushing the I didn't know that the interpolation functions are available even within templates, but they are (I could use one to include another file that way... however, a file included that way is included verbatim, so it can't have interpolation functions in it). |
Hi @geek876! I haven't read this fully but to give a quick drive-by answer that might get you further quicker than there is an answer: you might want to look at the |
Thanks @llarsson and @jen20 Now I have my module as
Then I call this module
I have
This complained that Then in module, I changed
But then started to get error |
Try also
And a template that looks like so...
|
Thanks @mrwacky42. The |
I'm assuming this is the official stance of terraform ... i.e. map and lists are not going to be supported? .. |
|
still ... it would be nice though to support more than what the DSL supports ... A primary example being userdata for cloudinit, terraform is a pain when it comes to conditionals and customization |
As of right now, This is very likely to change eventually, but there's a lot of internal work to do before we can get there to teach Terraform core how to deal with things that are dynamically-typed. For the time being, workarounds (such as those discussed above) are required for handling lists and maps. The most general workaround is to use the I'm sorry things aren't smoother in this area. I can only ask for patience as we design and implement the necessary changes to enable this to be improved, which is something we have already started to investigate. |
@gambol99 https://www.terraform.io/docs/providers/template/d/cloudinit_config.html should work in the meantime, also. |
I was able to get this to work with an in-line policy by wrapping my terraform list variable with
You can also get extra explicit and define your whitelist as a map where the keys are the IP(s) and the values are their canonical descriptions (this is nice for creating well-named
|
In addition to the suggestions above, I recommend to use |
This issue has been automatically migrated to hashicorp/terraform-provider-template#40 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-template#40. |
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. |
I want to render a template as below (effectively create an AWS Policy)
My Template file test.tpl is
How do I pass
${whitelist_ips}
as list to template when I render it ?I tried the usual way as below but it gives me template parse error
My use case is that I don't want to hard-code the IPs within access policy and want to provide a way to pass it as a variable like
The text was updated successfully, but these errors were encountered: