
Recently, when I was using Terraform to provision virtual network structure, I had to find a solution to create 4 predefined subnets within a given network range. Initially - as PoC - I used string manipulation to obtain the ranges, but I haven’t liked it. Then I found two built-in terraform functions, that are a great help when working with network aspect: cidrsubnet
and cidrsubnets
.