github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/setsubtract.html.md (about)

     1  ---
     2  layout: "language"
     3  page_title: "setsubtract - Functions - Configuration Language"
     4  sidebar_current: "docs-funcs-collection-setsubtract"
     5  description: |-
     6    The setsubtract function returns a new set containing the elements
     7    from the first set that are not present in the second set
     8  ---
     9  
    10  # `setsubtract` Function
    11  
    12  The `setsubtract` function returns a new set containing the elements from the first set that are not present in the second set. In other words, it computes the
    13  [relative complement](https://en.wikipedia.org/wiki/Complement_(set_theory)#Relative_complement) of the second set.
    14  
    15  ```hcl
    16  setsubtract(a, b)
    17  ```
    18  
    19  ## Examples
    20  
    21  ```
    22  > setsubtract(["a", "b", "c"], ["a", "c"])
    23  [
    24    "b",
    25  ]
    26  ```
    27  
    28  ### Set Difference (Symmetric Difference)
    29  
    30  ```
    31  > setunion(setsubtract(["a", "b", "c"], ["a", "c", "d"]), setsubtract(["a", "c", "d"], ["a", "b", "c"]))
    32  [
    33    "b",
    34    "d",
    35  ]
    36  ```
    37  
    38  
    39  ## Related Functions
    40  
    41  * [`setintersection`](./setintersection.html) computes the _intersection_ of multiple sets
    42  * [`setproduct`](./setproduct.html) computes the _Cartesian product_ of multiple
    43    sets.
    44  * [`setunion`](./setunion.html) computes the _union_ of
    45    multiple sets.