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