github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/collection/setunion.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: setunion - Functions - Configuration Language
     4  sidebar_title: 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  ```shell-session
    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`](/docs/job-specification/hcl2/functions/collection/contains) tests whether a given list or set contains
    39    a given element value.
    40  - [`setintersection`](/docs/job-specification/hcl2/functions/collection/setintersection) computes the _intersection_ of
    41    multiple sets.
    42  - [`setproduct`](/docs/job-specification/hcl2/functions/collection/setproduct) computes the _Cartesian product_ of multiple
    43    sets.