Skip to content

Data Source: awsVpcPeeringConnection

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

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 awsRouteTableRt = new aws.routeTable.RouteTable(this, "rt", {
  vpcId: "${aws_vpc.foo.id}",
});
const dataAwsVpcPeeringConnectionPc =
  new aws.dataAwsVpcPeeringConnection.DataAwsVpcPeeringConnection(this, "pc", {
    peerCidrBlock: "10.0.1.0/22",
    vpcId: "${aws_vpc.foo.id}",
  });
new aws.route.Route(this, "r", {
  destinationCidrBlock: dataAwsVpcPeeringConnectionPc.peerCidrBlock,
  routeTableId: awsRouteTableRt.id,
  vpcPeeringConnectionId: dataAwsVpcPeeringConnectionPc.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.

  • id - (Optional) ID of the specific VPC Peering Connection to retrieve.

  • status - (Optional) Status of the specific VPC Peering Connection to retrieve.

  • vpcId - (Optional) ID of the requester VPC of the specific VPC Peering Connection to retrieve.

  • ownerId - (Optional) AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.

  • cidrBlock - (Optional) Primary CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.

  • region - (Optional) Region of the requester VPC of the specific VPC Peering Connection to retrieve.

  • peerVpcId - (Optional) ID of the accepter VPC of the specific VPC Peering Connection to retrieve.

  • peerOwnerId - (Optional) AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.

  • peerCidrBlock - (Optional) Primary CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.

  • peerRegion - (Optional) Region of the accepter VPC of the specific VPC Peering Connection to retrieve.

  • filter - (Optional) Custom filter block as described below.

  • tags - (Optional) Map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.

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

  • name - (Required) Name of the field to filter by, as defined by the underlying AWS API.

  • values - (Required) Set of values that are accepted for the given field. A VPC Peering Connection will be selected if any one of the given values matches.

Attributes Reference

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

  • accepter - Configuration block that describes [VPC Peering Connection] (https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options set for the accepter VPC.

  • cidrBlockSet - List of objects with CIDR blocks of the requester VPC.

  • peerCidrBlockSet - List of objects with CIDR blocks of the accepter VPC.

  • requester - Configuration block that describes [VPC Peering Connection] (https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options set for the requester VPC.

Accepter and Requester Attributes Reference

  • allowRemoteVpcDnsResolution - Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.

  • allowClassicLinkToRemoteVpc - Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC peering connection.

  • allowVpcToRemoteClassicLink - Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC peering connection.

CIDR block set Attributes Reference

  • cidrBlock - CIDR block associated to the VPC of the specific VPC Peering Connection.

Timeouts

Configuration options:

  • read - (Default 20M)