mirror of
https://github.com/opentffoundation/opentf.git
synced 2026-01-25 12:00:16 -05:00
* add setdifference and setsubtract functions and docs * remove setdifference as it is not implemented correct in underlying lib * Update setintersection.html.md * Update setproduct.html.md * Update setunion.html.md
1.3 KiB
1.3 KiB
layout, page_title, sidebar_current, description
| layout | page_title | sidebar_current | description |
|---|---|---|---|
| functions | setsubtract - Functions - Configuration Language | docs-funcs-collection-setsubtract | The setsubtract function returns a new set containing the elements from the first set that are not present in the second set |
setsubtract Function
-> Note: This page is about Terraform 0.12 and later. For Terraform 0.11 and earlier, see 0.11 Configuration Language: Interpolation Syntax.
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
relative complement of the first set in the second set.
setsubtract(a, b)
Examples
> setsubtract(["a", "b", "c"], ["a", "c"])
[
"b",
]
Set Difference (Symmetric Difference)
> setunion(setsubtract(["a", "b", "c"], ["a", "c", "d"]), setsubtract(["a", "c", "d"], ["a", "b", "c"]))
[
"b",
"d",
]
Related Functions
setintersectioncomputes the intersection of multiple setssetproductcomputes the Cartesian product of multiple sets.setunioncomputes the union of multiple sets.