@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
157 lines • 6.97 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.VpcPeeringConnectionAccepter = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* 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
*
* ### Cross-Account Peering Or Cross-Region Peering AWS Provider v6 (and below)
*
* ```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"});
* const peerVpc = new aws.ec2.Vpc("peer", {cidrBlock: "10.1.0.0/16"});
* 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),
* peerRegion: "us-west-2",
* 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",
* },
* });
* ```
*
* ### Cross-Region Peering (Same Account) AWS Provider v7 (and above)
*
* ```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"});
* const peer = new aws.ec2.Vpc("peer", {
* region: "us-west-2",
* cidrBlock: "10.1.0.0/16",
* });
* // Requester's side of the connection.
* const peerVpcPeeringConnection = new aws.ec2.VpcPeeringConnection("peer", {
* vpcId: main.id,
* peerVpcId: peer.id,
* peerRegion: "us-west-2",
* autoAccept: false,
* tags: {
* Side: "Requester",
* },
* });
* // Accepter's side of the connection.
* const peerVpcPeeringConnectionAccepter = new aws.ec2.VpcPeeringConnectionAccepter("peer", {
* region: "us-west-2",
* vpcPeeringConnectionId: peerVpcPeeringConnection.id,
* autoAccept: true,
* tags: {
* Side: "Accepter",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import VPC Peering Connection Accepters using the Peering Connection ID. For example:
*
* ```sh
* $ pulumi import aws:ec2/vpcPeeringConnectionAccepter:VpcPeeringConnectionAccepter example pcx-12345678
* ```
* Certain resource arguments, like `auto_accept`, do not have an EC2 API method for reading the information after peering connection creation. If the argument is set in the Pulumi program on an imported resource, Pulumi will always show a difference. To workaround this behavior, either omit the argument from the Pulumi program or use `ignore_changes` to hide the difference. For example:
*/
class VpcPeeringConnectionAccepter extends pulumi.CustomResource {
/**
* Get an existing VpcPeeringConnectionAccepter 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 VpcPeeringConnectionAccepter(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of VpcPeeringConnectionAccepter. 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'] === VpcPeeringConnectionAccepter.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["acceptStatus"] = state?.acceptStatus;
resourceInputs["accepter"] = state?.accepter;
resourceInputs["autoAccept"] = state?.autoAccept;
resourceInputs["peerOwnerId"] = state?.peerOwnerId;
resourceInputs["peerRegion"] = state?.peerRegion;
resourceInputs["peerVpcId"] = state?.peerVpcId;
resourceInputs["region"] = state?.region;
resourceInputs["requester"] = state?.requester;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["vpcId"] = state?.vpcId;
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["autoAccept"] = args?.autoAccept;
resourceInputs["region"] = args?.region;
resourceInputs["requester"] = args?.requester;
resourceInputs["tags"] = args?.tags;
resourceInputs["vpcPeeringConnectionId"] = args?.vpcPeeringConnectionId;
resourceInputs["acceptStatus"] = undefined /*out*/;
resourceInputs["peerOwnerId"] = undefined /*out*/;
resourceInputs["peerRegion"] = undefined /*out*/;
resourceInputs["peerVpcId"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["vpcId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(VpcPeeringConnectionAccepter.__pulumiType, name, resourceInputs, opts);
}
}
exports.VpcPeeringConnectionAccepter = VpcPeeringConnectionAccepter;
/** @internal */
VpcPeeringConnectionAccepter.__pulumiType = 'aws:ec2/vpcPeeringConnectionAccepter:VpcPeeringConnectionAccepter';
//# sourceMappingURL=vpcPeeringConnectionAccepter.js.map