You can use terraform merge() function to combine multiple maps into a single map. merge() takes an arbitrary number of maps or objects, and returns a single map or object that contains a merged set of elements from all arguments.
Syntax: merge(map1, map2, ..)
Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
## Open terraform console terraform console ## Merge multiple maps into a single map merge({a=1, c=2, d=3},{b=4, f=5}) ## Returns ## { ## "a" = 1 ## "b" = 4 ## "c" = 2 ## "d" = 3 ## "f" = 5 ## } |