4 min read
Let's imagine we want to create a security group with the following ingress rules:
ingress_rules = [
{
protocol = "tcp"
cidr_blocks = [ "1.1.1.1/32", "2.2.2.2/32" ]
},
{
protocol = "tcp"
cidr_blocks = [ "1.2.3.4/32" ]
}
]
For each of the following ports:
services = ["80", "443", "8080"]
We can use the terraform function setproduct() to calculate all the combinations of elements from the given sets. That's also called the Cartesian product. For this example it's going to be 2x3.
16/06/2021
Read more...