github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/setunion.mdx (about) 1 --- 2 page_title: setunion - Functions - Configuration Language 3 description: |- 4 The setunion function takes multiple sets and produces a single set 5 containing the elements from all of the given sets. 6 --- 7 8 # `setunion` Function 9 10 The `setunion` function takes multiple sets and produces a single set 11 containing the elements from all of the given sets. In other words, it 12 computes the [union](https://en.wikipedia.org/wiki/Union_\(set_theory\)) of 13 the sets. 14 15 ```hcl 16 setunion(sets...) 17 ``` 18 19 ## Examples 20 21 ``` 22 > setunion(["a", "b"], ["b", "c"], ["d"]) 23 [ 24 "d", 25 "b", 26 "c", 27 "a", 28 ] 29 ``` 30 31 The given arguments are converted to sets, so the result is also a set and 32 the ordering of the given elements is not preserved. 33 34 ## Related Functions 35 36 * [`contains`](/language/functions/contains) tests whether a given list or set contains 37 a given element value. 38 * [`setintersection`](/language/functions/setintersection) computes the _intersection_ of 39 multiple sets. 40 * [`setproduct`](/language/functions/setproduct) computes the _Cartesian product_ of multiple 41 sets. 42 * [`setsubtract`](/language/functions/setsubtract) computes the _relative complement_ of two sets