@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
150 lines • 5.96 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.PeeringConnectionOptions = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const foo = new aws.ec2.Vpc("foo", {cidrBlock: "10.0.0.0/16"});
* const bar = new aws.ec2.Vpc("bar", {cidrBlock: "10.1.0.0/16"});
* const fooVpcPeeringConnection = new aws.ec2.VpcPeeringConnection("foo", {
* vpcId: foo.id,
* peerVpcId: bar.id,
* autoAccept: true,
* });
* const fooPeeringConnectionOptions = new aws.ec2.PeeringConnectionOptions("foo", {
* vpcPeeringConnectionId: fooVpcPeeringConnection.id,
* accepter: {
* allowRemoteVpcDnsResolution: true,
* },
* });
* ```
*
* ### Cross-Account Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const main = new aws.ec2.Vpc("main", {
* cidrBlock: "10.0.0.0/16",
* enableDnsSupport: true,
* enableDnsHostnames: true,
* });
* const peerVpc = new aws.ec2.Vpc("peer", {
* cidrBlock: "10.1.0.0/16",
* enableDnsSupport: true,
* enableDnsHostnames: true,
* });
* const peer = aws.getCallerIdentity({});
* // Requester's side of the connection.
* const peerVpcPeeringConnection = new aws.ec2.VpcPeeringConnection("peer", {
* vpcId: main.id,
* peerVpcId: peerVpc.id,
* peerOwnerId: peer.then(peer => peer.accountId),
* autoAccept: false,
* tags: {
* Side: "Requester",
* },
* });
* // Accepter's side of the connection.
* const peerVpcPeeringConnectionAccepter = new aws.ec2.VpcPeeringConnectionAccepter("peer", {
* vpcPeeringConnectionId: peerVpcPeeringConnection.id,
* autoAccept: true,
* tags: {
* Side: "Accepter",
* },
* });
* const requester = new aws.ec2.PeeringConnectionOptions("requester", {
* vpcPeeringConnectionId: peerVpcPeeringConnectionAccepter.id,
* requester: {
* allowRemoteVpcDnsResolution: true,
* },
* });
* const accepter = new aws.ec2.PeeringConnectionOptions("accepter", {
* vpcPeeringConnectionId: peerVpcPeeringConnectionAccepter.id,
* accepter: {
* allowRemoteVpcDnsResolution: true,
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import VPC Peering Connection Options using the VPC peering `id`. For example:
*
* ```sh
* $ pulumi import aws:ec2/peeringConnectionOptions:PeeringConnectionOptions foo pcx-111aaa111
* ```
*/
class PeeringConnectionOptions extends pulumi.CustomResource {
/**
* Get an existing PeeringConnectionOptions resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new PeeringConnectionOptions(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of PeeringConnectionOptions. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === PeeringConnectionOptions.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accepter"] = state?.accepter;
resourceInputs["region"] = state?.region;
resourceInputs["requester"] = state?.requester;
resourceInputs["vpcPeeringConnectionId"] = state?.vpcPeeringConnectionId;
}
else {
const args = argsOrState;
if (args?.vpcPeeringConnectionId === undefined && !opts.urn) {
throw new Error("Missing required property 'vpcPeeringConnectionId'");
}
resourceInputs["accepter"] = args?.accepter;
resourceInputs["region"] = args?.region;
resourceInputs["requester"] = args?.requester;
resourceInputs["vpcPeeringConnectionId"] = args?.vpcPeeringConnectionId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PeeringConnectionOptions.__pulumiType, name, resourceInputs, opts);
}
}
exports.PeeringConnectionOptions = PeeringConnectionOptions;
/** @internal */
PeeringConnectionOptions.__pulumiType = 'aws:ec2/peeringConnectionOptions:PeeringConnectionOptions';
//# sourceMappingURL=peeringConnectionOptions.js.map