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
LookupVpcPeeringConnectionin the Go SDK.
public static class GetVpcPeeringConnection {
public static Task<GetVpcPeeringConnectionResult> InvokeAsync(GetVpcPeeringConnectionArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Cidr
Block string The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.
- Filters
List<Get
Vpc Peering Connection Filter Args> Custom filter block as described below.
- Id string
The ID of the specific VPC Peering Connection to retrieve.
- Owner
Id string The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.
- Peer
Cidr stringBlock The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.
- Peer
Owner stringId The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.
- Peer
Region string The region of the accepter VPC of the specific VPC Peering Connection to retrieve.
- Peer
Vpc stringId 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.
- Dictionary<string, string>
A map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.
- Vpc
Id string The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
- Cidr
Block string The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.
- Filters
[]Get
Vpc Peering Connection Filter Custom filter block as described below.
- Id string
The ID of the specific VPC Peering Connection to retrieve.
- Owner
Id string The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.
- Peer
Cidr stringBlock The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.
- Peer
Owner stringId The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.
- Peer
Region string The region of the accepter VPC of the specific VPC Peering Connection to retrieve.
- Peer
Vpc stringId 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.
- map[string]string
A map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.
- Vpc
Id string The ID of the requester VPC of the specific VPC Peering Connection to retrieve.
- cidr
Block string The CIDR block of the requester VPC of the specific VPC Peering Connection to retrieve.
- filters
Get
Vpc Peering Connection Filter[] Custom filter block as described below.
- id string
The ID of the specific VPC Peering Connection to retrieve.
- owner
Id string The AWS account ID of the owner of the requester VPC of the specific VPC Peering Connection to retrieve.
- peer
Cidr stringBlock The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.
- peer
Owner stringId The AWS account ID of the owner of the accepter VPC of the specific VPC Peering Connection to retrieve.
- peer
Region string The region of the accepter VPC of the specific VPC Peering Connection to retrieve.
- peer
Vpc stringId 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.
- {[key: string]: string}
A map of tags, each pair of which must exactly match a pair on the desired VPC Peering Connection.
- vpc
Id 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[Get
Vpc Peering Connection Filter] 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_ strblock The CIDR block of the accepter VPC of the specific VPC Peering Connection to retrieve.
- peer_
owner_ strid 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_ strid 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.
- 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.
- Cidr
Block string - Id string
- Owner
Id string - Peer
Cidr stringBlock - Peer
Owner stringId - Peer
Region string - Peer
Vpc stringId - Region string
- Requester Dictionary<string, bool>
A configuration block that describes VPC Peering Connection options set for the requester VPC.
- Status string
- Dictionary<string, string>
- Vpc
Id string - Filters
List<Get
Vpc Peering Connection Filter>
- Accepter map[string]bool
A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- Cidr
Block string - Id string
- Owner
Id string - Peer
Cidr stringBlock - Peer
Owner stringId - Peer
Region string - Peer
Vpc stringId - Region string
- Requester map[string]bool
A configuration block that describes VPC Peering Connection options set for the requester VPC.
- Status string
- map[string]string
- Vpc
Id string - Filters
[]Get
Vpc Peering Connection Filter
- accepter {[key: string]: boolean}
A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- cidr
Block string - id string
- owner
Id string - peer
Cidr stringBlock - peer
Owner stringId - peer
Region string - peer
Vpc stringId - region string
- requester {[key: string]: boolean}
A configuration block that describes VPC Peering Connection options set for the requester VPC.
- status string
- {[key: string]: string}
- vpc
Id string - filters
Get
Vpc Peering Connection Filter[]
- 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_ strblock - peer_
owner_ strid - peer_
region str - peer_
vpc_ strid - region str
- requester Dict[str, Boolean]
A configuration block that describes VPC Peering Connection options set for the requester VPC.
- status str
- Dict[str, str]
- vpc_
id str - filters
List[Get
Vpc Peering Connection Filter]
Supporting Types
GetVpcPeeringConnectionFilter
- 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
awsTerraform Provider.