PeeringConnectionOptions

class PeeringConnectionOptions : KotlinCustomResource

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 and requester 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

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.VpcPeeringConnection;
import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
import com.pulumi.aws.ec2.PeeringConnectionOptions;
import com.pulumi.aws.ec2.PeeringConnectionOptionsArgs;
import com.pulumi.aws.ec2.inputs.PeeringConnectionOptionsAccepterArgs;
import com.pulumi.aws.ec2.inputs.PeeringConnectionOptionsRequesterArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var fooVpc = new Vpc("fooVpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
var bar = new Vpc("bar", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.build());
var fooVpcPeeringConnection = new VpcPeeringConnection("fooVpcPeeringConnection", VpcPeeringConnectionArgs.builder()
.vpcId(fooVpc.id())
.peerVpcId(bar.id())
.autoAccept(true)
.build());
var fooPeeringConnectionOptions = new PeeringConnectionOptions("fooPeeringConnectionOptions", PeeringConnectionOptionsArgs.builder()
.vpcPeeringConnectionId(fooVpcPeeringConnection.id())
.accepter(PeeringConnectionOptionsAccepterArgs.builder()
.allowRemoteVpcDnsResolution(true)
.build())
.requester(PeeringConnectionOptionsRequesterArgs.builder()
.allowVpcToRemoteClassicLink(true)
.allowClassicLinkToRemoteVpc(true)
.build())
.build());
}
}

Cross-Account Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.Provider;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.ec2.VpcPeeringConnection;
import com.pulumi.aws.ec2.VpcPeeringConnectionArgs;
import com.pulumi.aws.ec2.VpcPeeringConnectionAccepter;
import com.pulumi.aws.ec2.VpcPeeringConnectionAccepterArgs;
import com.pulumi.aws.ec2.PeeringConnectionOptions;
import com.pulumi.aws.ec2.PeeringConnectionOptionsArgs;
import com.pulumi.aws.ec2.inputs.PeeringConnectionOptionsRequesterArgs;
import com.pulumi.aws.ec2.inputs.PeeringConnectionOptionsAccepterArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var requester = new Provider("requester");
var accepter = new Provider("accepter");
var main = new Vpc("main", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.enableDnsSupport(true)
.enableDnsHostnames(true)
.build(), CustomResourceOptions.builder()
.provider(aws.requester())
.build());
var peerVpc = new Vpc("peerVpc", VpcArgs.builder()
.cidrBlock("10.1.0.0/16")
.enableDnsSupport(true)
.enableDnsHostnames(true)
.build(), CustomResourceOptions.builder()
.provider(aws.accepter())
.build());
final var peerCallerIdentity = AwsFunctions.getCallerIdentity();
var peerVpcPeeringConnection = new VpcPeeringConnection("peerVpcPeeringConnection", VpcPeeringConnectionArgs.builder()
.vpcId(main.id())
.peerVpcId(peerVpc.id())
.peerOwnerId(peerCallerIdentity.applyValue(getCallerIdentityResult -> getCallerIdentityResult.accountId()))
.autoAccept(false)
.tags(Map.of("Side", "Requester"))
.build(), CustomResourceOptions.builder()
.provider(aws.requester())
.build());
var peerVpcPeeringConnectionAccepter = new VpcPeeringConnectionAccepter("peerVpcPeeringConnectionAccepter", VpcPeeringConnectionAccepterArgs.builder()
.vpcPeeringConnectionId(peerVpcPeeringConnection.id())
.autoAccept(true)
.tags(Map.of("Side", "Accepter"))
.build(), CustomResourceOptions.builder()
.provider(aws.accepter())
.build());
var requesterPeeringConnectionOptions = new PeeringConnectionOptions("requesterPeeringConnectionOptions", PeeringConnectionOptionsArgs.builder()
.vpcPeeringConnectionId(peerVpcPeeringConnectionAccepter.id())
.requester(PeeringConnectionOptionsRequesterArgs.builder()
.allowRemoteVpcDnsResolution(true)
.build())
.build(), CustomResourceOptions.builder()
.provider(aws.requester())
.build());
var accepterPeeringConnectionOptions = new PeeringConnectionOptions("accepterPeeringConnectionOptions", PeeringConnectionOptionsArgs.builder()
.vpcPeeringConnectionId(peerVpcPeeringConnectionAccepter.id())
.accepter(PeeringConnectionOptionsAccepterArgs.builder()
.allowRemoteVpcDnsResolution(true)
.build())
.build(), CustomResourceOptions.builder()
.provider(aws.accepter())
.build());
}
}

Import

VPC Peering Connection Options can be imported using the vpc peering id, e.g.,

$ pulumi import aws:ec2/peeringConnectionOptions:PeeringConnectionOptions foo pcx-111aaa111

Properties

Link copied to clipboard

An optional configuration block that allows for VPC Peering Connection (https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to be set for the VPC that accepts the peering connection (a maximum of one).

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A optional configuration block that allows for VPC Peering Connection (https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to be set for the VPC that requests the peering connection (a maximum of one).

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard

The ID of the requester VPC peering connection.