open-nomad/website/pages/docs/job-specification/hcl2/functions/ipnet/cidrnetmask.mdx
Mahmood Ali d1e139c3fb
Docs for HCL2 (#9322)
Add more detailed HCL2 docs, mostly lifted from Packer with tweaks for Nomad.

The function docs are basically verbatim taken from Packer with basic string substitutions. I commented out some for_each details as the examples are mostly driven towards Packer resources. I'll iterate on those with better Nomad examples.
2020-11-29 20:36:41 -05:00

34 lines
856 B
Plaintext

---
layout: docs
page_title: cidrnetmask - Functions - Configuration Language
sidebar_title: cidrnetmask
description: |-
The cidrnetmask function converts an IPv4 address prefix given in CIDR
notation into a subnet mask address.
---
# `cidrnetmask` Function
`cidrnetmask` converts an IPv4 address prefix given in CIDR notation into
a subnet mask address.
```hcl
cidrnetmask(prefix)
```
`prefix` must be given in IPv4 CIDR notation, as defined in
[RFC 4632 section 3.1](https://tools.ietf.org/html/rfc4632#section-3.1).
The result is a subnet address formatted in the conventional dotted-decimal
IPv4 address syntax, as expected by some software.
CIDR notation is the only valid notation for IPv6 addresses, so `cidrnetmask`
produces an error if given an IPv6 address.
## Examples
```shell-session
> cidrnetmask("172.16.0.0/12")
255.240.0.0
```