github.com/iaas-resource-provision/iaas-rpc@v1.0.7-0.20211021023331-ed21f798c408/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  ## Examples
    29  
    30  ```
    31  > cidrnetmask("172.16.0.0/12")
    32  255.240.0.0
    33  ```