Get list of all possible VPC subnet IP using cidrsubnet

26 views Asked by At

How to see all possible VPC subnet IP using cidrsubnet

Example,

"1.0.0.0/28",
"2.0.0.0/28",
"3.0.0.0/28",
"0.1.0.0/28",
"0.2.0.0/28",
"0.3.0.0/28",
"0.0.1.0/28",
"0.0.2.0/28",
"0.0.3.0/28",
"0.0.0.1/28",
"0.0.0.2/28",
"0.0.0.3/28"
1

There are 1 answers

0
Vinit Khandelwal On

Here is how you can see them all and understand

output cidr_subnet {
    value = [for i in range(4): [for j in range(9): [for k in range(pow(2, j)): cidrsubnet("0.0.0.0/${8 * i}", j, k)]]]
}