Data Source: aws_vpc_peering_connection

The VPC Peering Connection data source provides details about a specific VPC peering connection.

Example Usage

# Declare the data source
data "aws_vpc_peering_connection" "pc" {
  vpc_id          = aws_vpc.foo.id
  peer_cidr_block = "10.0.1.0/22"
}

# Create a route table
resource "aws_route_table" "rt" {
  vpc_id = aws_vpc.foo.id
}

# Create a route
resource "aws_route" "r" {
  route_table_id            = aws_route_table.rt.id
  destination_cidr_block    = data.aws_vpc_peering_connection.pc.peer_cidr_block
  vpc_peering_connection_id = data.aws_vpc_peering_connection.pc.id
}

Argument Reference

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

More complex filters can be expressed using one or more filter sub-blocks, which take the following arguments:

Attribute Reference

All of the argument attributes except filter are also exported as result attributes.

Accepter and Requester Attribute Reference

CIDR block set Attribute Reference

Timeouts

Configuration options: