(Solved) How to loop through locals and list at the same time to generate resources #299
Unanswered
JavierLopezT
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Have you managed to find a solution this? I am looking for the same thing : ) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
EDIT: I solved the problem but I am not able to close the discussion
I have the following tf file:
I want to maintain the locals as it is (different usage_roles for each schema and hardcoded here) while having several values as database for each schema. In pseudo-code it would be:
So that we have the same schema resource in the three different databases. I have read some articles that point me to the belief that it is possible to make this loop but pre assigning all the values, meaning that I would have to put usage_roles in a list or something instead of hardcoding here in locals, which I think is less readable. For instance:
https://stackoverflow.com/questions/57570505/terraform-how-to-use-for-each-loop-on-a-list-of-objects-to-create-resources
Is even possible what I am asking for? If so, how? Thank you very much in advance
Beta Was this translation helpful? Give feedback.
All reactions