github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/merge.html.md (about) 1 --- 2 layout: "language" 3 page_title: "merge - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-collection-merge" 5 description: |- 6 The merge function takes an arbitrary number maps or objects, and returns a 7 single map or object that contains a merged set of elements from all 8 arguments. 9 --- 10 11 # `merge` Function 12 13 `merge` takes an arbitrary number of maps or objects, and returns a single map 14 or object that contains a merged set of elements from all arguments. 15 16 If more than one given map or object defines the same key or attribute, then 17 the one that is later in the argument sequence takes precedence. If the 18 argument types do not match, the resulting type will be an object matching the 19 type structure of the attributes after the merging rules have been applied. 20 21 ## Examples 22 23 ``` 24 > merge({a="b", c="d"}, {e="f", c="z"}) 25 { 26 "a" = "b" 27 "c" = "z" 28 "e" = "f" 29 } 30 ``` 31 32 ``` 33 > merge({a="b"}, {a=[1,2], c="z"}, {d=3}) 34 { 35 "a" = [ 36 1, 37 2, 38 ] 39 "c" = "z" 40 "d" = 3 41 } 42 ```