-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
concat() function does not support lists for inputs as documented #6657
Comments
Looks like more of a syntax issue, I don't think you can declare lists with the example you provided:
Once you're inside the outer On the other hand, if the variables refer to lists, it should still work, e.g. (pseudo):
|
Hi @alexsomesan! As @eedwardsdisco points out the issue is that there is no syntax for list literals in HIL. We may change this in 0.7 to add support, but for now you need to use concat, or a resource field which results in a list as input to |
Was it implemented? @jen20 |
@jen20 @alexsomesan Can't you just do this? |
Maybe it's a bit late but I had a similar problem (which was my own mistake..) and so I came here and saw this... tested it like:
Worked. |
concat with inner lists does not work, I just use join with empty delimter this was what I want to do I replaced it like this |
I was looking for the solution to concat two lists and found the solution using in below format -
this is how I can use it after this -
Hope someone will find it useful |
Update2: I was blind and made a copy-n-paste mistake. I copied Working example for the situation I had:
|
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. |
Hi there,
Terraform Version
Terraform v0.6.15
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
According to interpolation syntax docs the concat() function should take two lists as arguments and join them and return the resulting list.
Actual Behavior
However, I noticed that in practice this is not the case, and instead the concat() function only works on string typed inputs, effectively concatenating them, as it's name implies.
I'm not sure if the documentation is misinforming and joining lists was never the intended feature or if the feature should actually work but it doesn't.
Steps to Reproduce
Using the above configuration snipped, do a plan:
terraform plan
And you should see an error like:
Error loading config: Error loading /Users/alex/workspace/terraform-test/tls.tf: Error reading config for tls_cert_request[api-server-key-csr]: parse error: syntax error
Now, switch the arguments to concat() to plain strings, like:
And the
terraform plan
should go through and produce:Notice how the
ip_addresses.0:
value is the result of joining the two input strings.The text was updated successfully, but these errors were encountered: