Resource: aws_vpc_ipam_pool_cidr

Provisions a CIDR from an IPAM address pool.

Example Usage

Basic usage:

data "aws_region" "current" {}

resource "aws_vpc_ipam" "example" {
  operating_regions {
    region_name = data.aws_region.current.name
  }
}

resource "aws_vpc_ipam_pool" "example" {
  address_family = "ipv4"
  ipam_scope_id  = aws_vpc_ipam.example.private_default_scope_id
  locale         = data.aws_region.current.name
}

resource "aws_vpc_ipam_pool_cidr" "example" {
  ipam_pool_id = aws_vpc_ipam_pool.example.id
  cidr         = "172.20.0.0/16"
}

Provision Public IPv6 Pool CIDRs:

data "aws_region" "current" {}

resource "aws_vpc_ipam" "example" {
  operating_regions {
    region_name = data.aws_region.current.name
  }
}

resource "aws_vpc_ipam_pool" "ipv6_test_public" {
  address_family = "ipv6"
  ipam_scope_id  = aws_vpc_ipam.example.public_default_scope_id
  locale         = "us-east-1"
  description    = "public ipv6"

  publicly_advertisable = false
  public_ip_source      = "amazon"
  aws_service           = "ec2"
}

resource "aws_vpc_ipam_pool_cidr" "ipv6_test_public" {
  ipam_pool_id   = aws_vpc_ipam_pool.ipv6_test_public.id
  netmask_length = 52
}

Argument Reference

This resource supports the following arguments:

cidr_authorization_context

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import IPAMs using the <cidr>_<ipam-pool-id>. For example:

NOTE: Do not use the IPAM Pool Cidr ID as this was introduced after the resource already existed.

import {
  to = aws_vpc_ipam_pool_cidr.example
  id = "172.20.0.0/24_ipam-pool-0e634f5a1517cccdc"
}

Using terraform import, import IPAMs using the <cidr>_<ipam-pool-id>. For example:

NOTE: Do not use the IPAM Pool Cidr ID as this was introduced after the resource already existed.

% terraform import aws_vpc_ipam_pool_cidr.example 172.20.0.0/24_ipam-pool-0e634f5a1517cccdc