Expand description
Provides a resource to manage VPC peering connection options.
NOTE on VPC Peering Connections and VPC Peering Connection Options: This provider provides both a standalone VPC Peering Connection Options and a VPC Peering Connection resource with
accepter
andrequester
attributes. Do not manage options for the same VPC peering connection in both a VPC Peering Connection resource and a VPC Peering Connection Options resource. Doing so will cause a conflict of options and will overwrite the options. Using a VPC Peering Connection Options resource decouples management of the connection options from management of the VPC Peering Connection and allows options to be set correctly in cross-region and cross-account scenarios.
§Example Usage
§Basic Usage
use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
let bar = vpc::create(
"bar",
VpcArgs::builder().cidr_block("10.1.0.0/16").build_struct(),
);
let foo = vpc::create(
"foo",
VpcArgs::builder().cidr_block("10.0.0.0/16").build_struct(),
);
let fooPeeringConnectionOptions = peering_connection_options::create(
"fooPeeringConnectionOptions",
PeeringConnectionOptionsArgs::builder()
.accepter(
PeeringConnectionOptionsAccepter::builder()
.allowRemoteVpcDnsResolution(true)
.build_struct(),
)
.vpc_peering_connection_id("${fooVpcPeeringConnection.id}")
.build_struct(),
);
let fooVpcPeeringConnection = vpc_peering_connection::create(
"fooVpcPeeringConnection",
VpcPeeringConnectionArgs::builder()
.auto_accept(true)
.peer_vpc_id("${bar.id}")
.vpc_id("${foo.id}")
.build_struct(),
);
}
§Cross-Account Usage
resources:
main:
type: aws:ec2:Vpc
properties:
cidrBlock: 10.0.0.0/16
enableDnsSupport: true
enableDnsHostnames: true
peerVpc:
type: aws:ec2:Vpc
name: peer
properties:
cidrBlock: 10.1.0.0/16
enableDnsSupport: true
enableDnsHostnames: true
# Requester's side of the connection.
peerVpcPeeringConnection:
type: aws:ec2:VpcPeeringConnection
name: peer
properties:
vpcId: ${main.id}
peerVpcId: ${peerVpc.id}
peerOwnerId: ${peer.accountId}
autoAccept: false
tags:
Side: Requester
# Accepter's side of the connection.
peerVpcPeeringConnectionAccepter:
type: aws:ec2:VpcPeeringConnectionAccepter
name: peer
properties:
vpcPeeringConnectionId: ${peerVpcPeeringConnection.id}
autoAccept: true
tags:
Side: Accepter
requester:
type: aws:ec2:PeeringConnectionOptions
properties:
vpcPeeringConnectionId: ${peerVpcPeeringConnectionAccepter.id}
requester:
allowRemoteVpcDnsResolution: true
accepter:
type: aws:ec2:PeeringConnectionOptions
properties:
vpcPeeringConnectionId: ${peerVpcPeeringConnectionAccepter.id}
accepter:
allowRemoteVpcDnsResolution: true
variables:
peer:
fn::invoke:
function: aws:getCallerIdentity
arguments: {}
§Import
Using pulumi import
, import VPC Peering Connection Options using the VPC peering id
. For example:
$ pulumi import aws:ec2/peeringConnectionOptions:PeeringConnectionOptions foo pcx-111aaa111
Structs§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments