awscc_ec2_vpc (Resource)

Specifies a virtual private cloud (VPC). You can optionally request an IPv6 CIDR block for the VPC. You can request an Amazon-provided IPv6 CIDR block from Amazon's pool of IPv6 addresses, or an IPv6 CIDR block from an IPv6 address pool that you provisioned through bring your own IP addresses (BYOIP). For more information, see Virtual private clouds (VPC) in the Amazon VPC User Guide.

Example Usage

Basic usage

To create a VPC

resource "awscc_ec2_vpc" "main" {
  cidr_block = "10.0.0.0/16"
}

Basic usage with tags

To create a VPC with tags

resource "awscc_ec2_vpc" "main" {
  cidr_block       = "10.0.0.0/16"
  instance_tenancy = "default"
  tags = [{
    key   = "Name"
    value = "main"
  }]
}

Advanced usage

To create a VPC with CIDR from AWS IPAM

resource "awscc_ec2_ipam" "main" {
  operating_regions = [{
    region_name = "us-east-1"
  }]
}

resource "awscc_ec2_ipam_pool" "main" {
  address_family = "ipv4"
  ipam_scope_id  = awscc_ec2_ipam.main.private_default_scope_id
  locale         = "us-east-1"
}

resource "awscc_ec2_ipam_pool_cidr" "main" {
  ipam_pool_id = awscc_ec2_ipam_pool.main.id
  cidr         = "10.0.0.0/16"
}

resource "awscc_ec2_vpc" "main" {
  ipv_4_ipam_pool_id   = awscc_ec2_ipam_pool.main.id
  ipv_4_netmask_length = 20
  depends_on = [
    awscc_ec2_ipam_pool_cidr.main
  ]
}

Create a VPC with Amazon provided IPV6 pool

resource "awscc_ec2_vpc_cidr_block" "main" {
  amazon_provided_ipv_6_cidr_block = true
  vpc_id                           = awscc_ec2_vpc.selected.id
}

resource "awscc_ec2_vpc" "main" {
  cidr_block = "10.0.0.0/16"
}

Schema

Optional

Read-Only

Nested Schema for tags

Required:

Import

Import is supported using the following syntax:

$ terraform import awscc_ec2_vpc.example <resource ID>