github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/website/docs/configuration/functions/cidrnetmask.html.md (about) 1 --- 2 layout: "functions" 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 -> **Note:** This page is about Terraform 0.12 and later. For Terraform 0.11 and 13 earlier, see 14 [0.11 Configuration Language: Interpolation Syntax](../../configuration-0-11/interpolation.html). 15 16 `cidrnetmask` converts an IPv4 address prefix given in CIDR notation into 17 a subnet mask address. 18 19 ```hcl 20 cidrnetmask(prefix) 21 ``` 22 23 `prefix` must be given in IPv4 CIDR notation, as defined in 24 [RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1). 25 26 The result is a subnet address formatted in the conventional dotted-decimal 27 IPv4 address syntax, as expected by some software. 28 29 CIDR notation is the only valid notation for IPv6 addresses, so `cidrnetmask` 30 produces an error if given an IPv6 address. 31 32 ## Examples 33 34 ``` 35 > cidrnetmask("172.16.0.0/12") 36 255.240.0.0 37 ```