Skip to content

Resource: awsVpcIpv4CidrBlockAssociation

Provides a resource to associate additional IPv4 CIDR blocks with a VPC.

When a VPC is created, a primary IPv4 CIDR block for the VPC must be specified. The awsVpcIpv4CidrBlockAssociation resource allows further IPv4 CIDR blocks to be added to the VPC.

Example 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 awsVpcMain = new aws.vpc.Vpc(this, "main", {
  cidrBlock: "10.0.0.0/16",
});
new aws.vpcIpv4CidrBlockAssociation.VpcIpv4CidrBlockAssociation(
  this,
  "secondary_cidr",
  {
    cidrBlock: "172.2.0.0/16",
    vpcId: awsVpcMain.id,
  }
);

Argument Reference

The following arguments are supported:

  • cidrBlock - (Optional) The IPv4 CIDR block for the VPC. CIDR can be explicitly set or it can be derived from IPAM using ipv4NetmaskLength.
  • ipv4IpamPoolId - (Optional) The ID of an IPv4 IPAM pool you want to use for allocating this VPC's CIDR. IPAM is a VPC feature that you can use to automate your IP address management workflows including assigning, tracking, troubleshooting, and auditing IP addresses across AWS Regions and accounts. Using IPAM you can monitor IP address usage throughout your AWS Organization.
  • ipv4NetmaskLength - (Optional) The netmask length of the IPv4 CIDR you want to allocate to this VPC. Requires specifying a ipv4IpamPoolId.
  • vpcId - (Required) The ID of the VPC to make the association with.

Attributes Reference

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

  • id - The ID of the VPC CIDR association

Timeouts

Configuration options:

  • create - (Default 10M)
  • delete - (Default 10M)

Import

awsVpcIpv4CidrBlockAssociation can be imported by using the VPC CIDR Association ID, e.g.,

$ terraform import aws_vpc_ipv4_cidr_block_association.example vpc-cidr-assoc-xxxxxxxx