Terraform v0.12.19
I have some network data sourced in the format subnet + netmask (e.g. 172.16.0.0 mask 255.255.255.0) and I need to convert into cidr format (e.g. 172.16.0.0/24)
add two new functions:
> cidrnet("10.10.10.10", "255.255.255.0")
10.10.10.0/24
> cidrnet("192.168.0.200", "255.255.255.128")
192.168.0.128/25
> cidrbitmask("255.255.255.0")
24
> cidrbitmask("255.255.192.0")
18
Hey @carmineesposito73,
I'd love to understand a little more about your use case here and develop a better understanding of the workflow involved.
While the Terraform Team isn't planning on adding these functions ourselves, we'd welcome a community PR if these functions were of broader interest to our community members.
I'm working on something like that:
I can get information on networks in this format
"gateway" = "172.16.1.1"
"netmask" = "255.255.255.0"
and I would like to use this information to assign an IP address to some resource, but I haven't find a way to use the information above, since cidrhost requires a cidr notation
cidrhost("172.16.1.0/24", N)
This would be generally useful to have.
This would be useful.
Most helpful comment
This would be generally useful to have.