-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
For_each on data source like http #12696
Comments
Hi @mahsoud, Regarding this feature, this would imply we support dynamic on top-level blocks, which is something that is unsupported for everything. It looks to me that what you're looking for is a list of URIs to fetch, which is something that may be implemented separately from this language change, as part of a data source specialised to do this. Out of curiosity, do you have a practical example of the problem you're trying to solve? Maybe there's something we can help to express with the current capabilities of HCL in Packer. I'll keep this open for discussion purposes, but I'll mark this as a wontfix for now, since it's likely not something we'll take-on soon (and possibly long-term even). Thanks! |
I am doing an experiment that might be related to this. I have a custom plugin that fetches some external API and returns a list of objects but currently the Datasource can only use map of strings instead of a list of objects. This causes my Custom Plugin Data Source to only support a return of 1 object(map of strings) and i have to make multiple calls of this plugin inside a loop. Wouldn't this quality for something that Terraform already does in their loop expressions |
Hi @lmayorga1980, not sure I understand your use-case, could you provide a quick example template to illustrate what you're trying to do? |
I can say I have a similar use case; we have AMIs pushed to various regions and we'd like to go back and tag them after the fact with "ready for production". So to get the AMI IDs into a list, what would be great is if I could do something like this, which is what I would do in Terraform:
|
any updates on this? I'm also running into this # Define data sources to fetch values from the Amazon Parameter Store
data "amazon-parameterstore" "get_parameter_list" {
name = "/image-pipeline/${var.project_name}/parameters"
}
data "amazon-parameterstore" "parameters" {
for_each = toset(split(",", data.amazon-parameterstore.get_parameter_list.value))
name = "/image-pipeline/${var.project_name}/${each.key}"
} |
Description
for_each attribute support on configuration resource
Use Case(s)
At times we may iterate on multiple data sources.
Potential configuration
Potential References
The text was updated successfully, but these errors were encountered: