Created
January 13, 2024 23:00
-
-
Save ImIOImI/94a1d6cecc9145a41d8478c867095d0b to your computer and use it in GitHub Desktop.
Create a product of two maps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I find myself having to get the product of two maps fairly regularly, this is one way to do it | |
locals { | |
pre_merge = [ | |
for map1_key, map1_object in local.map1 : { | |
for map2_key, map2_value in local.map2 : "${map1_key}-${map2_key}" => { | |
map2_value_name = map2_value | |
object_name = object.name | |
object_id = object.id | |
} | |
} | |
] | |
links = merge(local.pre_merge...) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment