github.com/muratcelep/terraform@v1.1.0-beta2-not-internal-4/website/docs/language/functions/cidrnetmask.html.md (about) 1 --- 2 layout: "language" 3 page_title: "cidrnetmask - Functions - Configuration Language" 4 sidebar_current: "docs-funcs-ipnet-cidrnetmask" 5 description: |- 6 The cidrnetmask function converts an IPv4 address prefix given in CIDR 7 notation into a subnet mask address. 8 --- 9 10 # `cidrnetmask` Function 11 12 `cidrnetmask` converts an IPv4 address prefix given in CIDR notation into 13 a subnet mask address. 14 15 ```hcl 16 cidrnetmask(prefix) 17 ``` 18 19 `prefix` must be given in IPv4 CIDR notation, as defined in 20 [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1). 21 22 The result is a subnet address formatted in the conventional dotted-decimal 23 IPv4 address syntax, as expected by some software. 24 25 CIDR notation is the only valid notation for IPv6 addresses, so `cidrnetmask` 26 produces an error if given an IPv6 address. 27 28 -> **Note:** As a historical accident, this function interprets IPv4 address 29 octets that have leading zeros as decimal numbers, which is contrary to some 30 other systems which interpret them as octal. We have preserved this behavior 31 for backward compatibility, but recommend against relying on this behavior. 32 33 ## Examples 34 35 ``` 36 > cidrnetmask("172.16.0.0/12") 37 255.240.0.0 38 ```