GetVpcPeeringConnection

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

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var pc = Output.Create(Aws.Ec2.GetVpcPeeringConnection.InvokeAsync(new Aws.Ec2.GetVpcPeeringConnectionArgs
        {
            PeerCidrBlock = "10.0.1.0/22",
            VpcId = aws_vpc.Foo.Id,
        }));
        // Create a route table
        var rt = new Aws.Ec2.RouteTable("rt", new Aws.Ec2.RouteTableArgs
        {
            VpcId = aws_vpc.Foo.Id,
        });
        // Create a route
        var route = new Aws.Ec2.Route("route", new Aws.Ec2.RouteArgs
        {
            DestinationCidrBlock = pc.Apply(pc => pc.PeerCidrBlock),
            RouteTableId = rt.Id,
            VpcPeeringConnectionId = pc.Apply(pc => pc.Id),
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        opt0 := "10.0.1.0/22"
        opt1 := aws_vpc.Foo.Id
        pc, err := ec2.LookupVpcPeeringConnection(ctx, &ec2.LookupVpcPeeringConnectionArgs{
            PeerCidrBlock: &opt0,
            VpcId:         &opt1,
        }, nil)
        if err != nil {
            return err
        }
        rt, err := ec2.NewRouteTable(ctx, "rt", &ec2.RouteTableArgs{
            VpcId: pulumi.String(aws_vpc.Foo.Id),
        })
        if err != nil {
            return err
        }
        _, err = ec2.NewRoute(ctx, "route", &ec2.RouteArgs{
            DestinationCidrBlock:   pulumi.String(pc.PeerCidrBlock),
            RouteTableId:           rt.ID(),
            VpcPeeringConnectionId: pulumi.String(pc.Id),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

pc = aws.ec2.get_vpc_peering_connection(peer_cidr_block="10.0.1.0/22",
    vpc_id=aws_vpc["foo"]["id"])
# Create a route table
rt = aws.ec2.RouteTable("rt", vpc_id=aws_vpc["foo"]["id"])
# Create a route
route = aws.ec2.Route("route",
    destination_cidr_block=pc.peer_cidr_block,
    route_table_id=rt.id,
    vpc_peering_connection_id=pc.id)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Declare the data source
const pc = aws_vpc_foo.id.apply(id => aws.ec2.getVpcPeeringConnection({
    peerCidrBlock: "10.0.1.0/22",
    vpcId: id,
}, { async: true }));
// Create a route table
const rt = new aws.ec2.RouteTable("rt", {
    vpcId: aws_vpc_foo.id,
});
// Create a route
const route = new aws.ec2.Route("r", {
    destinationCidrBlock: pc.peerCidrBlock!,
    routeTableId: rt.id,
    vpcPeeringConnectionId: pc.id!,
});

Using GetVpcPeeringConnection

function getVpcPeeringConnection(args: GetVpcPeeringConnectionArgs, opts?: InvokeOptions): Promise<GetVpcPeeringConnectionResult>
function  get_vpc_peering_connection(cidr_block=None, filters=None, id=None, owner_id=None, peer_cidr_block=None, peer_owner_id=None, peer_region=None, peer_vpc_id=None, region=None, status=None, tags=None, vpc_id=None, opts=None)
func LookupVpcPeeringConnection(ctx *Context, args *LookupVpcPeeringConnectionArgs, opts ...InvokeOption) (*LookupVpcPeeringConnectionResult, error)

Note: This function is named LookupVpcPeeringConnection in the Go SDK.

public static class GetVpcPeeringConnection {
    public static Task<GetVpcPeeringConnectionResult> InvokeAsync(GetVpcPeeringConnectionArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

CidrBlock string

The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.

Filters List<GetVpcPeeringConnectionFilterArgs>

Custom filter block as described below.

Id string

The ID of the specific VPC Peering Connection to retrieve.

OwnerId string

The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.

PeerCidrBlock string

The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.

PeerOwnerId string

The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.

PeerRegion string

The region of the accepter VPC of the specific VPC Peering Connection to retrieve.

PeerVpcId string

The ID of the accepter VPC of the specific VPC Peering Connection to retrieve.

Region string

The region of the requester VPC of the specific VPC Peering Connection to retrieve.

Status string

The status of the specific VPC Peering Connection to retrieve.

Tags Dictionary<string, string>

A map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.

VpcId string

The ID of the requester VPC of the specific VPC Peering Connection to retrieve.

CidrBlock string

The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.

Filters []GetVpcPeeringConnectionFilter

Custom filter block as described below.

Id string

The ID of the specific VPC Peering Connection to retrieve.

OwnerId string

The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.

PeerCidrBlock string

The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.

PeerOwnerId string

The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.

PeerRegion string

The region of the accepter VPC of the specific VPC Peering Connection to retrieve.

PeerVpcId string

The ID of the accepter VPC of the specific VPC Peering Connection to retrieve.

Region string

The region of the requester VPC of the specific VPC Peering Connection to retrieve.

Status string

The status of the specific VPC Peering Connection to retrieve.

Tags map[string]string

A map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.

VpcId string

The ID of the requester VPC of the specific VPC Peering Connection to retrieve.

cidrBlock string

The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.

filters GetVpcPeeringConnectionFilter[]

Custom filter block as described below.

id string

The ID of the specific VPC Peering Connection to retrieve.

ownerId string

The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.

peerCidrBlock string

The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.

peerOwnerId string

The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.

peerRegion string

The region of the accepter VPC of the specific VPC Peering Connection to retrieve.

peerVpcId string

The ID of the accepter VPC of the specific VPC Peering Connection to retrieve.

region string

The region of the requester VPC of the specific VPC Peering Connection to retrieve.

status string

The status of the specific VPC Peering Connection to retrieve.

tags {[key: string]: string}

A map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.

vpcId string

The ID of the requester VPC of the specific VPC Peering Connection to retrieve.

cidr_block str

The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.

filters List[GetVpcPeeringConnectionFilter]

Custom filter block as described below.

id str

The ID of the specific VPC Peering Connection to retrieve.

owner_id str

The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.

peer_cidr_block str

The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.

peer_owner_id str

The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.

peer_region str

The region of the accepter VPC of the specific VPC Peering Connection to retrieve.

peer_vpc_id str

The ID of the accepter VPC of the specific VPC Peering Connection to retrieve.

region str

The region of the requester VPC of the specific VPC Peering Connection to retrieve.

status str

The status of the specific VPC Peering Connection to retrieve.

tags Dict[str, str]

A map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.

vpc_id str

The ID of the requester VPC of the specific VPC Peering Connection to retrieve.

GetVpcPeeringConnection Result

The following output properties are available:

Accepter Dictionary<string, bool>

A configuration block that describes VPC Peering Connection options set for the accepter VPC.

CidrBlock string
Id string
OwnerId string
PeerCidrBlock string
PeerOwnerId string
PeerRegion string
PeerVpcId string
Region string
Requester Dictionary<string, bool>

A configuration block that describes VPC Peering Connection options set for the requester VPC.

Status string
Tags Dictionary<string, string>
VpcId string
Filters List<GetVpcPeeringConnectionFilter>
Accepter map[string]bool

A configuration block that describes VPC Peering Connection options set for the accepter VPC.

CidrBlock string
Id string
OwnerId string
PeerCidrBlock string
PeerOwnerId string
PeerRegion string
PeerVpcId string
Region string
Requester map[string]bool

A configuration block that describes VPC Peering Connection options set for the requester VPC.

Status string
Tags map[string]string
VpcId string
Filters []GetVpcPeeringConnectionFilter
accepter {[key: string]: boolean}

A configuration block that describes VPC Peering Connection options set for the accepter VPC.

cidrBlock string
id string
ownerId string
peerCidrBlock string
peerOwnerId string
peerRegion string
peerVpcId string
region string
requester {[key: string]: boolean}

A configuration block that describes VPC Peering Connection options set for the requester VPC.

status string
tags {[key: string]: string}
vpcId string
filters GetVpcPeeringConnectionFilter[]
accepter Dict[str, Boolean]

A configuration block that describes VPC Peering Connection options set for the accepter VPC.

cidr_block str
id str
owner_id str
peer_cidr_block str
peer_owner_id str
peer_region str
peer_vpc_id str
region str
requester Dict[str, Boolean]

A configuration block that describes VPC Peering Connection options set for the requester VPC.

status str
tags Dict[str, str]
vpc_id str
filters List[GetVpcPeeringConnectionFilter]

Supporting Types

GetVpcPeeringConnectionFilter

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Name string

The name of the field to filter by, as defined by the underlying AWS API.

Values List<string>

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.

Name string

The name of the field to filter by, as defined by the underlying AWS API.

Values []string

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.

name string

The name of the field to filter by, as defined by the underlying AWS API.

values string[]

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.

name str

The name of the field to filter by, as defined by the underlying AWS API.

values List[str]

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.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.