-
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
Feature Request - Allow list/array in 'query' in 'external' data source #12249
Comments
Hi @vikas027! Sorry for this limitation. Currently this data source is constrained by some assumptions made by Terraform's schema system, which doesn't allow for mixed types in a map of values. This might change in future -- certainly more flexibility here is desirable if possible -- but for now the workaround is to pass in the list as a delimited string and then split it again in the external script: query = {
list_of_images = "${join(" ", var.list_of_images)}"
} Incidentally, your filename In future they may be a |
Hey @apparentlymart , Thanks for the quick response. Yeah, I know what I am trying to do is not ideal but I could not an elegant way to run nested loops as asked and suggested here. I am pretty sure this would be a common requirement. Any ideas/hints, how to do the same. Thanks. |
+1 for this issue. It would be nice for Terraform to actually support valid JSON output instead of comma delimited strings. Here is what my external data source executes: It outputs:
However, when I run terraform plan, I get: |
+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. |
Terraform Version
0.8.7
Affected Resource(s)
external data source
Terraform Configuration Files
Expected Behavior
List
list_of_images
should have been passed to the script.Actual Behavior
Terraform Version
0.8.7
Affected Resource(s)
Terraform Configuration Files
create_policy.sh
Expected Behavior
Terraform shouldn't thrown an error when the the bash script is producing a valid json
Actual Behavior
Steps to Reproduce
Create the resource and the script files and run
terraform plan
The text was updated successfully, but these errors were encountered: