Skip to content

Resource: awsVpcIpamPool

Provides an IP address pool resource for IPAM.

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 dataAwsRegionCurrent = new aws.dataAwsRegion.DataAwsRegion(
  this,
  "current",
  {}
);
const awsVpcIpamExample = new aws.vpcIpam.VpcIpam(this, "example", {
  operatingRegions: [
    {
      regionName: dataAwsRegionCurrent.name,
    },
  ],
});
const awsVpcIpamPoolExample = new aws.vpcIpamPool.VpcIpamPool(
  this,
  "example_2",
  {
    addressFamily: "ipv4",
    ipamScopeId: awsVpcIpamExample.privateDefaultScopeId,
    locale: dataAwsRegionCurrent.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsVpcIpamPoolExample.overrideLogicalId("example");

Nested Pools:

/*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 dataAwsRegionCurrent = new aws.dataAwsRegion.DataAwsRegion(
  this,
  "current",
  {}
);
const awsVpcIpamExample = new aws.vpcIpam.VpcIpam(this, "example", {
  operatingRegions: [
    {
      regionName: dataAwsRegionCurrent.name,
    },
  ],
});
const awsVpcIpamPoolParent = new aws.vpcIpamPool.VpcIpamPool(this, "parent", {
  addressFamily: "ipv4",
  ipamScopeId: awsVpcIpamExample.privateDefaultScopeId,
});
new aws.vpcIpamPoolCidr.VpcIpamPoolCidr(this, "parent_test", {
  cidr: "172.2.0.0/16",
  ipamPoolId: awsVpcIpamPoolParent.id,
});
const awsVpcIpamPoolChild = new aws.vpcIpamPool.VpcIpamPool(this, "child", {
  addressFamily: "ipv4",
  ipamScopeId: awsVpcIpamExample.privateDefaultScopeId,
  locale: dataAwsRegionCurrent.name,
  sourceIpamPoolId: awsVpcIpamPoolParent.id,
});
new aws.vpcIpamPoolCidr.VpcIpamPoolCidr(this, "child_test", {
  cidr: "172.2.0.0/24",
  ipamPoolId: awsVpcIpamPoolChild.id,
});

Argument Reference

The following arguments are supported:

  • addressFamily - (Optional) The IP protocol assigned to this pool. You must choose either IPv4 or IPv6 protocol for a pool.
  • allocationDefaultNetmaskLength - (Optional) A default netmask length for allocations added to this pool. If, for example, the CIDR assigned to this pool is 10.0.0.0/8 and you enter 16 here, new allocations will default to 10.0.0.0/16 (unless you provide a different netmask value when you create the new allocation).
  • allocationMaxNetmaskLength - (Optional) The maximum netmask length that will be required for CIDR allocations in this pool.
  • allocationMinNetmaskLength - (Optional) The minimum netmask length that will be required for CIDR allocations in this pool.
  • allocationResourceTags - (Optional) Tags that are required for resources that use CIDRs from this IPAM pool. Resources that do not have these tags will not be allowed to allocate space from the pool. If the resources have their tags changed after they have allocated space or if the allocation tagging requirements are changed on the pool, the resource may be marked as noncompliant.
  • autoImport - (Optional) If you include this argument, IPAM automatically imports any VPCs you have in your scope that fall within the CIDR range in the pool.
  • awsService - (Optional) Limits which AWS service the pool can be used in. Only useable on public scopes. Valid Values: ec2.
  • description - (Optional) A description for the IPAM pool.
  • ipamScopeId - (Optional) The ID of the scope in which you would like to create the IPAM pool.
  • locale - (Optional) The locale in which you would like to create the IPAM pool. Locale is the Region where you want to make an IPAM pool available for allocations. You can only create pools with locales that match the operating Regions of the IPAM. You can only create VPCs from a pool whose locale matches the VPC's Region. Possible values: Any AWS region, such as usEast1.
  • publiclyAdvertisable - (Optional) Defines whether or not IPv6 pool space is publicly advertisable over the internet. This argument is required if addressFamily = "ipv6" and publicIpSource = "byoip", default is false. This option is not available for IPv4 pool space or if publicIpSource = "amazon".
  • publicIpSource - (Optional) The IP address source for pools in the public scope. Only used for provisioning IP address CIDRs to pools in the public scope. Valid values are byoip or amazon. Default is byoip.
  • sourceIpamPoolId - (Optional) The ID of the source IPAM pool. Use this argument to create a child pool within an existing pool.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Attributes Reference

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

  • arn - Amazon Resource Name (ARN) of IPAM
  • id - The ID of the IPAM
  • state - The ID of the IPAM
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Import

IPAMs can be imported using the ipamPoolId, e.g.

$ terraform import aws_vpc_ipam_pool.example ipam-pool-0958f95207d978e1e