VpcPeeringConnectionAccepter
Provides a resource to manage the accepter’s side of a VPC Peering Connection.
When a cross-account (requester’s AWS account differs from the accepter’s AWS account) or an inter-region
VPC Peering Connection is created, a VPC Peering Connection resource is automatically created in the
accepter’s account.
The requester can use the aws.ec2.VpcPeeringConnection resource to manage its side of the connection
and the accepter can use the aws.ec2.VpcPeeringConnectionAccepter resource to “adopt” its side of the
connection into management.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var peer = new Aws.Provider("peer", new Aws.ProviderArgs
{
Region = "us-west-2",
});
var main = new Aws.Ec2.Vpc("main", new Aws.Ec2.VpcArgs
{
CidrBlock = "10.0.0.0/16",
});
var peerVpc = new Aws.Ec2.Vpc("peerVpc", new Aws.Ec2.VpcArgs
{
CidrBlock = "10.1.0.0/16",
}, new CustomResourceOptions
{
Provider = "aws.peer",
});
var peerCallerIdentity = Output.Create(Aws.GetCallerIdentity.InvokeAsync());
// Requester's side of the connection.
var peerVpcPeeringConnection = new Aws.Ec2.VpcPeeringConnection("peerVpcPeeringConnection", new Aws.Ec2.VpcPeeringConnectionArgs
{
AutoAccept = false,
PeerOwnerId = peerCallerIdentity.Apply(peerCallerIdentity => peerCallerIdentity.AccountId),
PeerRegion = "us-west-2",
PeerVpcId = peerVpc.Id,
Tags =
{
{ "Side", "Requester" },
},
VpcId = main.Id,
});
// Accepter's side of the connection.
var peerVpcPeeringConnectionAccepter = new Aws.Ec2.VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter", new Aws.Ec2.VpcPeeringConnectionAccepterArgs
{
AutoAccept = true,
Tags =
{
{ "Side", "Accepter" },
},
VpcPeeringConnectionId = peerVpcPeeringConnection.Id,
}, new CustomResourceOptions
{
Provider = "aws.peer",
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/providers"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := providers.Newaws(ctx, "peer", &providers.awsArgs{
Region: pulumi.String("us-west-2"),
})
if err != nil {
return err
}
main, err := ec2.NewVpc(ctx, "main", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
peerVpc, err := ec2.NewVpc(ctx, "peerVpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("10.1.0.0/16"),
}, pulumi.Provider("aws.peer"))
if err != nil {
return err
}
peerCallerIdentity, err := aws.GetCallerIdentity(ctx, nil, nil)
if err != nil {
return err
}
peerVpcPeeringConnection, err := ec2.NewVpcPeeringConnection(ctx, "peerVpcPeeringConnection", &ec2.VpcPeeringConnectionArgs{
AutoAccept: pulumi.Bool(false),
PeerOwnerId: pulumi.String(peerCallerIdentity.AccountId),
PeerRegion: pulumi.String("us-west-2"),
PeerVpcId: peerVpc.ID(),
Tags: pulumi.StringMap{
"Side": pulumi.String("Requester"),
},
VpcId: main.ID(),
})
if err != nil {
return err
}
_, err = ec2.NewVpcPeeringConnectionAccepter(ctx, "peerVpcPeeringConnectionAccepter", &ec2.VpcPeeringConnectionAccepterArgs{
AutoAccept: pulumi.Bool(true),
Tags: pulumi.StringMap{
"Side": pulumi.String("Accepter"),
},
VpcPeeringConnectionId: peerVpcPeeringConnection.ID(),
}, pulumi.Provider("aws.peer"))
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
import pulumi_pulumi as pulumi
peer = pulumi.providers.Aws("peer", region="us-west-2")
main = aws.ec2.Vpc("main", cidr_block="10.0.0.0/16")
peer_vpc = aws.ec2.Vpc("peerVpc", cidr_block="10.1.0.0/16",
opts=ResourceOptions(provider="aws.peer"))
peer_caller_identity = aws.get_caller_identity()
# Requester's side of the connection.
peer_vpc_peering_connection = aws.ec2.VpcPeeringConnection("peerVpcPeeringConnection",
auto_accept=False,
peer_owner_id=peer_caller_identity.account_id,
peer_region="us-west-2",
peer_vpc_id=peer_vpc.id,
tags={
"Side": "Requester",
},
vpc_id=main.id)
# Accepter's side of the connection.
peer_vpc_peering_connection_accepter = aws.ec2.VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter",
auto_accept=True,
tags={
"Side": "Accepter",
},
vpc_peering_connection_id=peer_vpc_peering_connection.id,
opts=ResourceOptions(provider="aws.peer"))import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const peer = new aws.Provider("peer", {
region: "us-west-2",
});
const main = new aws.ec2.Vpc("main", {
cidrBlock: "10.0.0.0/16",
});
const peerVpc = new aws.ec2.Vpc("peer", {
cidrBlock: "10.1.0.0/16",
}, { provider: peer });
const peerCallerIdentity = pulumi.output(aws.getCallerIdentity({ provider: peer, async: true }));
// Requester's side of the connection.
const peerVpcPeeringConnection = new aws.ec2.VpcPeeringConnection("peer", {
autoAccept: false,
peerOwnerId: peerCallerIdentity.accountId,
peerRegion: "us-west-2",
peerVpcId: peerVpc.id,
tags: {
Side: "Requester",
},
vpcId: main.id,
});
// Accepter's side of the connection.
const peerVpcPeeringConnectionAccepter = new aws.ec2.VpcPeeringConnectionAccepter("peer", {
autoAccept: true,
tags: {
Side: "Accepter",
},
vpcPeeringConnectionId: peerVpcPeeringConnection.id,
}, { provider: peer });Create a VpcPeeringConnectionAccepter Resource
new VpcPeeringConnectionAccepter(name: string, args: VpcPeeringConnectionAccepterArgs, opts?: CustomResourceOptions);def VpcPeeringConnectionAccepter(resource_name, opts=None, accepter=None, auto_accept=None, requester=None, tags=None, vpc_peering_connection_id=None, __props__=None);func NewVpcPeeringConnectionAccepter(ctx *Context, name string, args VpcPeeringConnectionAccepterArgs, opts ...ResourceOption) (*VpcPeeringConnectionAccepter, error)public VpcPeeringConnectionAccepter(string name, VpcPeeringConnectionAccepterArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args VpcPeeringConnectionAccepterArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args VpcPeeringConnectionAccepterArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VpcPeeringConnectionAccepterArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
VpcPeeringConnectionAccepter Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The VpcPeeringConnectionAccepter resource accepts the following input properties:
- Vpc
Peering stringConnection Id The VPC Peering Connection ID to manage.
- Accepter
Vpc
Peering Connection Accepter Accepter Args A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- Auto
Accept bool Whether or not to accept the peering request. Defaults to
false.- Requester
Vpc
Peering Connection Accepter Requester Args A configuration block that describes VPC Peering Connection options set for the requester VPC.
- Dictionary<string, string>
A map of tags to assign to the resource.
- Vpc
Peering stringConnection Id The VPC Peering Connection ID to manage.
- Accepter
Vpc
Peering Connection Accepter Accepter A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- Auto
Accept bool Whether or not to accept the peering request. Defaults to
false.- Requester
Vpc
Peering Connection Accepter Requester A configuration block that describes VPC Peering Connection options set for the requester VPC.
- map[string]string
A map of tags to assign to the resource.
- vpc
Peering stringConnection Id The VPC Peering Connection ID to manage.
- accepter
Vpc
Peering Connection Accepter Accepter A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- auto
Accept boolean Whether or not to accept the peering request. Defaults to
false.- requester
Vpc
Peering Connection Accepter Requester A configuration block that describes VPC Peering Connection options set for the requester VPC.
- {[key: string]: string}
A map of tags to assign to the resource.
- vpc_
peering_ strconnection_ id The VPC Peering Connection ID to manage.
- accepter
Dict[Vpc
Peering Connection Accepter Accepter] A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- auto_
accept bool Whether or not to accept the peering request. Defaults to
false.- requester
Dict[Vpc
Peering Connection Accepter Requester] A configuration block that describes VPC Peering Connection options set for the requester VPC.
- Dict[str, str]
A map of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the VpcPeeringConnectionAccepter resource produces the following output properties:
- Accept
Status string The status of the VPC Peering Connection request.
- Id string
- The provider-assigned unique ID for this managed resource.
- Peer
Owner stringId The AWS account ID of the owner of the requester VPC.
- Peer
Region string The region of the accepter VPC.
- Peer
Vpc stringId The ID of the requester VPC.
- Vpc
Id string The ID of the accepter VPC.
- Accept
Status string The status of the VPC Peering Connection request.
- Id string
- The provider-assigned unique ID for this managed resource.
- Peer
Owner stringId The AWS account ID of the owner of the requester VPC.
- Peer
Region string The region of the accepter VPC.
- Peer
Vpc stringId The ID of the requester VPC.
- Vpc
Id string The ID of the accepter VPC.
- accept
Status string The status of the VPC Peering Connection request.
- id string
- The provider-assigned unique ID for this managed resource.
- peer
Owner stringId The AWS account ID of the owner of the requester VPC.
- peer
Region string The region of the accepter VPC.
- peer
Vpc stringId The ID of the requester VPC.
- vpc
Id string The ID of the accepter VPC.
- accept_
status str The status of the VPC Peering Connection request.
- id str
- The provider-assigned unique ID for this managed resource.
- peer_
owner_ strid The AWS account ID of the owner of the requester VPC.
- peer_
region str The region of the accepter VPC.
- peer_
vpc_ strid The ID of the requester VPC.
- vpc_
id str The ID of the accepter VPC.
Look up an Existing VpcPeeringConnectionAccepter Resource
Get an existing VpcPeeringConnectionAccepter resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VpcPeeringConnectionAccepterState, opts?: CustomResourceOptions): VpcPeeringConnectionAccepterstatic get(resource_name, id, opts=None, accept_status=None, accepter=None, auto_accept=None, peer_owner_id=None, peer_region=None, peer_vpc_id=None, requester=None, tags=None, vpc_id=None, vpc_peering_connection_id=None, __props__=None);func GetVpcPeeringConnectionAccepter(ctx *Context, name string, id IDInput, state *VpcPeeringConnectionAccepterState, opts ...ResourceOption) (*VpcPeeringConnectionAccepter, error)public static VpcPeeringConnectionAccepter Get(string name, Input<string> id, VpcPeeringConnectionAccepterState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Accept
Status string The status of the VPC Peering Connection request.
- Accepter
Vpc
Peering Connection Accepter Accepter Args A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- Auto
Accept bool Whether or not to accept the peering request. Defaults to
false.- Peer
Owner stringId The AWS account ID of the owner of the requester VPC.
- Peer
Region string The region of the accepter VPC.
- Peer
Vpc stringId The ID of the requester VPC.
- Requester
Vpc
Peering Connection Accepter Requester Args A configuration block that describes VPC Peering Connection options set for the requester VPC.
- Dictionary<string, string>
A map of tags to assign to the resource.
- Vpc
Id string The ID of the accepter VPC.
- Vpc
Peering stringConnection Id The VPC Peering Connection ID to manage.
- Accept
Status string The status of the VPC Peering Connection request.
- Accepter
Vpc
Peering Connection Accepter Accepter A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- Auto
Accept bool Whether or not to accept the peering request. Defaults to
false.- Peer
Owner stringId The AWS account ID of the owner of the requester VPC.
- Peer
Region string The region of the accepter VPC.
- Peer
Vpc stringId The ID of the requester VPC.
- Requester
Vpc
Peering Connection Accepter Requester A configuration block that describes VPC Peering Connection options set for the requester VPC.
- map[string]string
A map of tags to assign to the resource.
- Vpc
Id string The ID of the accepter VPC.
- Vpc
Peering stringConnection Id The VPC Peering Connection ID to manage.
- accept
Status string The status of the VPC Peering Connection request.
- accepter
Vpc
Peering Connection Accepter Accepter A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- auto
Accept boolean Whether or not to accept the peering request. Defaults to
false.- peer
Owner stringId The AWS account ID of the owner of the requester VPC.
- peer
Region string The region of the accepter VPC.
- peer
Vpc stringId The ID of the requester VPC.
- requester
Vpc
Peering Connection Accepter Requester A configuration block that describes VPC Peering Connection options set for the requester VPC.
- {[key: string]: string}
A map of tags to assign to the resource.
- vpc
Id string The ID of the accepter VPC.
- vpc
Peering stringConnection Id The VPC Peering Connection ID to manage.
- accept_
status str The status of the VPC Peering Connection request.
- accepter
Dict[Vpc
Peering Connection Accepter Accepter] A configuration block that describes VPC Peering Connection options set for the accepter VPC.
- auto_
accept bool Whether or not to accept the peering request. Defaults to
false.- peer_
owner_ strid The AWS account ID of the owner of the requester VPC.
- peer_
region str The region of the accepter VPC.
- peer_
vpc_ strid The ID of the requester VPC.
- requester
Dict[Vpc
Peering Connection Accepter Requester] A configuration block that describes VPC Peering Connection options set for the requester VPC.
- Dict[str, str]
A map of tags to assign to the resource.
- vpc_
id str The ID of the accepter VPC.
- vpc_
peering_ strconnection_ id The VPC Peering Connection ID to manage.
Supporting Types
VpcPeeringConnectionAccepterAccepter
- Allow
Classic boolLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- Allow
Remote boolVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- Allow
Vpc boolTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
- Allow
Classic boolLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- Allow
Remote boolVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- Allow
Vpc boolTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
- allow
Classic booleanLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- allow
Remote booleanVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- allow
Vpc booleanTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
- allow
Classic boolLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- allow
Remote boolVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- allow
Vpc boolTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
VpcPeeringConnectionAccepterRequester
- Allow
Classic boolLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- Allow
Remote boolVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- Allow
Vpc boolTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
- Allow
Classic boolLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- Allow
Remote boolVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- Allow
Vpc boolTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
- allow
Classic booleanLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- allow
Remote booleanVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- allow
Vpc booleanTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
- allow
Classic boolLink To Remote Vpc Indicates whether a local ClassicLink connection can communicate with the peer VPC over the VPC Peering Connection.
- allow
Remote boolVpc Dns Resolution Indicates whether a local VPC can resolve public DNS hostnames to private IP addresses when queried from instances in a peer VPC.
- allow
Vpc boolTo Remote Classic Link Indicates whether a local VPC can communicate with a ClassicLink connection in the peer VPC over the VPC Peering Connection.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.