How to Iterate Through A List of Objects with Terraform's for_each function - sheldonhull.com #163
Replies: 8 comments
|
local.users_config.users seems to reference a "users" object that I don't see defined anywhere. |
|
@rtanner-tableau my apologies. I had my email notifications missing so didn't see this until now. Change Also for noting, I'll be trying this out soon when I have my next config project as I'm betting it's a lot more robust. Check this out from one of my all-time favorite terraform module creators. https://github.com/cloudposse/terraform-yaml-config cheers |
|
Thanks Sheldon! |
|
@maximivanov stoked to hear that. I write to help myself remember these things that took so much effort and were hard to find clear answers on. I'm always cheered to know some else found it helpful! Thanks for the follow-up. 👍 There are a lot more advanced ways to manipulate input with flatten and others, but for my use case I've not needed that yet. I'm also excited by terraform-yaml-config. There's a lot of potential to support some really great simple yaml config based solutions with a lot less effort. It leverages a deep merge feature as well so you can do some pretty creative solutions with it. I'll probably start relying on that a lot more over my own yaml manipulation. Good luck! |
|
Also thanks to @maximivanov answer I have a new resource. https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#for-expressions One of the things I've needed was more programmer level understanding of the syntax. Well the docs provide some help I find them too high level. When you get into this type of object manipulation it's hard to figure out without more of a spec. I'm pinning this link here as well since it actually explains in detail the structure of those clauses. reading through this will probably help me understand it a lot better too. |
|
Didn't know about the yaml config plugin. Looks useful! A topic for another blog post for you 😉 Yep HCL spec can be useful. Till not long ago I didn't even realize myself both |
|
@kabirg referenced this in k8 project noticed this when researching webmentions. I haven't tackled EKS but once with Cloudposse module and gitpod. Good luck! Hopefully you survive all the yaml :-) |
|
@sheldonhull lol appreciate it! Enjoyed your article too :) |
Uh oh!
There was an error while loading. Please reload this page.
How to Iterate Through A List of Objects with Terraform's for_each function
https://www.sheldonhull.com/blog/how-to-iterate-through-a-list-of-objects-with-terraforms-for-each-function/
All reactions