Open dustindortch opened 4 years ago
Hi @dustindortch,
Maps and sets are unordered, so the *
operator does not apply.
There are some additional details and examples in the duplicate #22562
Thanks
I am not asking how to use it but requesting a way to do something similar.
From: James Bardin notifications@github.com Sent: Tuesday, September 22, 2020 9:01 AM To: hashicorp/terraform terraform@noreply.github.com Cc: Dustin Dortch me@dustindortch.com; Mention mention@noreply.github.com Subject: Re: [hashicorp/terraform] "Splatting" map to for_each loop (#25966)
Hi @dustindortchhttps://github.com/dustindortch,
Maps and sets are unordered, so the * operator does not apply. There are some additional details and examples in the duplicate #22562https://github.com/hashicorp/terraform/issues/22562
Thanks
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/hashicorp/terraform/issues/25966#issuecomment-696704971, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AGC64ZAIGSP35ZTLHVYFT6TSHCNX5ANCNFSM4QIGS3NA.
Thanks @dustindortch, I changed the title to match what I think you're requesting.
Use-cases
In some cases repetition logic should change between iterations. For instance, if using Private Link on an Azure subnet that is different from the keys that might be more standard:
The usage of a
for_each
loop for a subnet is described here: https://www.hashicorp.com/blog/hashicorp-terraform-0-12-preview-for-and-for-each/We have to describe the placement of everything. However, if we were to use something like the keys in a map matching the properties of the resource, we would not need to worry about anything of. Maybe just:
Clearly, we might need logic externally for building out the map more appropriately, but if something in one of the maps in the list, then it could get applied, whereas the absence would be like leaving it absent in a standard fed