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