terraform-provider-utils

command module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

README

terraform-provider-utils

A Terraform provider that exposes utility functions for CIDR/IP network operations.

Functions

cidrcontains(containing_prefix, contained_prefix)

Returns true if the containing CIDR prefix fully encompasses the contained CIDR prefix.

provider::utils::cidrcontains("10.0.0.0/8", "10.1.0.0/16")    # true
provider::utils::cidrcontains("10.0.0.0/8", "192.168.0.0/16")  # false
provider::utils::cidrcontains("10.0.0.0/8", "10.1.2.3/32")     # true
cidroverlaps(prefix_a, prefix_b)

Returns true if two CIDR prefixes have any addresses in common.

provider::utils::cidroverlaps("10.0.0.0/8", "10.1.0.0/16")     # true
provider::utils::cidroverlaps("10.0.0.0/8", "192.168.0.0/16")  # false
cidrnoverlap(prefixes)

Returns true if no pair of CIDR prefixes in the list overlaps with each other.

provider::utils::cidrnoverlap(["10.0.0.0/8", "192.168.0.0/16", "172.16.0.0/12"])  # true
provider::utils::cidrnoverlap(["10.0.0.0/8", "10.1.0.0/16", "192.168.0.0/16"])    # false

All functions:

  • Require CIDR notation for all arguments (use /32 or /128 for single hosts)
  • Support both IPv4 and IPv6
  • Return an error if address families are mixed

Requirements

Building the Provider

go install

Developing the Provider

To generate documentation:

make generate

To run tests:

make testacc

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL