-
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
Cannot pass a list of maps to a resource/data #7705
Comments
Any updates on this? I ask only because of the release-0.7 tag with 0.7.3 being out and no traffic on this issue 👼 |
For example I could this to solve the variable number of listeners for an aws_elb ... This looks good output "output" { but resource "aws_elb" "elb" { gives listener.0: expected object, but got string |
Hitting the same issue with 0.9.1. This would be super useful! |
+1 |
4 similar comments
+1 |
+1 |
+1 |
👍 |
Hi all! Thanks for reporting this, @wr0ngway. This is one of a number of quirks with more complex data structures in Terraform right now, resulting from the fact that Terraform originally didn't support such structures at all and so the current state is a pragmatic intermediate step to allow simple use-cases to be addressed. We are planning to further improve the situation around complex structures, including looking at whether we can find a way to support dynamic generation of nested configuration blocks from variables, but we're not currently actively working on implementing this since things are still in the early design phase. Since this discussion seems to just be attracting upvotes at this point, I'm going to lock it to remove the noise for the many people who are following this issue. We'll unlock it again later when things are further along and we have more to discuss here. Thanks again! |
Hi all! Sorry for the long silence here; some outdated labeling on this issue caused me to miss it on a previous pass. This issue is actually covering the same problem as #7034, which has now been resolved in master with the introduction of the special |
For some cases and workloads we need to pass some modules to the task definition. The volumes are passed as a list of maps to the ecs_task_resource[1]. But the current syntax of terraform does not allow consume this value directly from a variable. Trying to do so, we hit the issues described in [2] and [3] (pending to report a specific bug). But we found out that it works if we build the map structure directly within the resource, and we use interpolation to consume the values of the map. Meanwhile the terraform project does not provide a definitive solution, we will implement the following workaround: - The module will receive configuration for one unique module, being the default a empty map {} - If the map is empty, a dummy volume will be passed as `name=dummy` and `host_path=/tmp/dummy_volume` This would cover our specific case in the short term, and can be later easily adapted to use a optional list of volumes. [1] https://www.terraform.io/docs/providers/aws/r/ecs_task_definition.html#volume [2] hashicorp/terraform#10407 [3] hashicorp/terraform#7705 (comment)
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
Terraform v0.7.0-rc3 (3f4857a)
Affected Resource(s)
Terraform Configuration Files
Debug Output
https://gist.github.com/dd910b4bdb9b2cbe03850080ff218ca9
Panic Output
N/A
Expected Behavior
Literal list of maps should work as a parameter to a resource or data source that takes a list of maps. The example uses a data source for ease in duplication, but the same error is seen when passing to a resource, e.g. aws_db_parameter_group.parameter
Actual Behavior
The resource doesn't see each map as a valid object:
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
N/A
References
The text was updated successfully, but these errors were encountered: