Skip to content

Data Source: awsVpcIpamPool

awsVpcIpamPool provides details about an IPAM pool.

This resource can prove useful when an ipam pool was created in another root module and you need the pool's id as an input variable. For example, pools can be shared via RAM and used to create vpcs with CIDRs from that pool.

Example Usage

The following example shows an account that has only 1 pool, perhaps shared via RAM, and using that pool id to create a VPC with a CIDR derived from AWS IPAM.

/*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 dataAwsVpcIpamPoolTest = new aws.dataAwsVpcIpamPool.DataAwsVpcIpamPool(
  this,
  "test",
  {
    filter: [
      {
        name: "description",
        values: ["*test*"],
      },
      {
        name: "address-family",
        values: ["ipv4"],
      },
    ],
  }
);
const awsVpcTest = new aws.vpc.Vpc(this, "test_1", {
  ipv4IpamPoolId: dataAwsVpcIpamPoolTest.id,
  ipv4NetmaskLength: 28,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsVpcTest.overrideLogicalId("test");

Argument Reference

The arguments of this data source act as filters for querying the available VPCs in the current region. The given filters must match exactly one VPC whose data will be exported as attributes.

  • ipamPoolId - (Optional) ID of the IPAM pool you would like information on.
  • filter - (Optional) Custom filter block as described below.

filter

  • name - (Required) The name of the filter. Filter names are case-sensitive.
  • values - (Required) The filter values. Filter values are case-sensitive.

Attributes Reference

All of the argument attributes except filter blocks are also exported as result attributes. This data source will complete the data by populating any fields that are not included in the configuration with the data for the selected VPC.

The following attribute is additionally exported:

  • addressFamily - IP protocol assigned to this pool.
  • allocationDefaultNetmaskLength - A default netmask length for allocations added to this pool. If, for example, the CIDR assigned to this pool is 10000/8 and you enter 16 here, new allocations will default to 10000/16.
  • allocationMaxNetmaskLength - The maximum netmask length that will be required for CIDR allocations in this pool.
  • allocationMinNetmaskLength - The minimum netmask length that will be required for CIDR allocations in this pool.
  • allocationResourceTags - Tags that are required to create resources in using this pool.
  • arn - ARN of the pool
  • autoImport - If enabled, IPAM will continuously look for resources within the CIDR range of this pool and automatically import them as allocations into your IPAM.
  • awsService - Limits which service in AWS that the pool can be used in. ec2 for example, allows users to use space for Elastic IP addresses and VPCs.
  • description - Description for the IPAM pool.
  • id - ID of the IPAM pool.
  • ipamScopeId - ID of the scope the pool belongs to.
  • locale - Locale is the Region where your pool is 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.
  • publiclyAdvertisable - Defines whether or not IPv6 pool space is publicly advertisable over the internet.
  • sourceIpamPoolId - ID of the source IPAM pool.
  • tags - Map of tags to assigned to the resource.

Timeouts

Configuration options:

  • read - (Default 20M)