Skip to content

Data Source: awsVpcIpamPreviewNextCidr

Previews a CIDR from an IPAM address pool. Only works for private IPv4.

\~> NOTE: This functionality is also encapsulated in a resource sharing the same name. The data source can be used when you need to use the cidr in a calculation of the same Root module, count for example. However, once a cidr range has been allocated that was previewed, the next refresh will find a new cidr and may force new resources downstream. Make sure to use Terraform's lifecycle ignoreChanges policy if this is undesirable.

Example Usage

Basic usage:

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const dataAwsVpcIpamPreviewNextCidrTest =
  new aws.dataAwsVpcIpamPreviewNextCidr.DataAwsVpcIpamPreviewNextCidr(
    this,
    "test",
    {
      depends_on: ["${aws_vpc_ipam_pool_cidr.test}"],
      ipamPoolId: "${aws_vpc_ipam_pool.test.id}",
      netmaskLength: 28,
    }
  );
const awsVpcIpamPoolCidrAllocationTest =
  new aws.vpcIpamPoolCidrAllocation.VpcIpamPoolCidrAllocation(this, "test_1", {
    cidr: dataAwsVpcIpamPreviewNextCidrTest.cidr,
    ipamPoolId: "${aws_vpc_ipam_pool.test.id}",
  });
awsVpcIpamPoolCidrAllocationTest.addOverride("lifecycle", [
  {
    ignore_changes: ["${cidr}"],
  },
]);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsVpcIpamPoolCidrAllocationTest.overrideLogicalId("test");

Argument Reference

The following arguments are supported:

  • disallowedCidrs - (Optional) Exclude a particular CIDR range from being returned by the pool.
  • ipamPoolId - (Required) ID of the pool to which you want to assign a CIDR.
  • netmaskLength - (Optional) Netmask length of the CIDR you would like to preview from the IPAM pool.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • cidr - Previewed CIDR from the pool.
  • id - ID of the preview.

Timeouts

Configuration options:

  • read - (Default 20M)