github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/setunion.html.md (about) 1 --- 2 layout: "functions" 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 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 13 earlier, see 14 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 15 16 The `setunion` function takes multiple sets and produces a single set 17 containing the elements from all of the given sets. In other words, it 18 computes the [union](https://en.wikipedia.org/wiki/Union_(set_theory)) of 19 the sets. 20 21 ```hcl 22 setunion(sets...) 23 ``` 24 25 ## Examples 26 27 ``` 28 > setunion(["a", "b"], ["b", "c"], ["d"]) 29 [ 30 "d", 31 "b", 32 "c", 33 "a", 34 ] 35 ``` 36 37 The given arguments are converted to sets, so the result is also a set and 38 the ordering of the given elements is not preserved. 39 40 ## Related Functions 41 42 * [`contains`](./contains.html) tests whether a given list or set contains 43 a given element value. 44 * [`setintersection`](./setintersection.html) computes the _intersection_ of 45 multiple sets. 46 * [`setproduct`](./setproduct.html) computes the _Cartesian product_ of multiple 47 sets. 48 * [`setsubtract`](./setsubtract.html) computes the _relative complement_ of two sets