github.com/hugorut/terraform@v1.1.3/website/docs/language/functions/setintersection.mdx (about)

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