I have two lists in terraform and want to get the intersection of these lists.
For example,
list1 = ["a", "b", "c"]
lists2 = ["b", "c", "d"]
I am looking to get output as ["b", "c"] using built-in terraform functions.
You are looking for something like this
output my_intersection {
value = setintersection( toset(var.list1), toset(var.list2) )
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With