UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

178 lines 7.57 kB
"use strict"; // *** 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.VpcPeeringConnection = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage a VPC peering connection. * * > **Note:** Modifying the VPC Peering Connection options requires peering to be active. An automatic activation * can be done using the `autoAccept` attribute. Alternatively, the VPC Peering * Connection has to be made active manually using other means. See notes below for * more information. * * > **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-account scenarios. * * > **Note:** For cross-account (requester's AWS account differs from the accepter's AWS account) or inter-region * VPC Peering Connections use the `aws.ec2.VpcPeeringConnection` resource to manage the requester's side of the * connection and use the `aws.ec2.VpcPeeringConnectionAccepter` resource to manage the accepter's side of the connection. * * > **Note:** Creating multiple `aws.ec2.VpcPeeringConnection` resources with the same `peerVpcId` and `vpcId` will not produce an error. Instead, AWS will return the connection `id` that already exists, resulting in multiple `aws.ec2.VpcPeeringConnection` resources with the same `id`. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const foo = new aws.ec2.VpcPeeringConnection("foo", { * peerOwnerId: peerOwnerId, * peerVpcId: bar.id, * vpcId: fooAwsVpc.id, * }); * ``` * * Basic usage with connection options: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const foo = new aws.ec2.VpcPeeringConnection("foo", { * peerOwnerId: peerOwnerId, * peerVpcId: bar.id, * vpcId: fooAwsVpc.id, * accepter: { * allowRemoteVpcDnsResolution: true, * }, * requester: { * allowRemoteVpcDnsResolution: true, * }, * }); * ``` * * Basic usage with tags: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const fooVpc = new aws.ec2.Vpc("foo", {cidrBlock: "10.1.0.0/16"}); * const bar = new aws.ec2.Vpc("bar", {cidrBlock: "10.2.0.0/16"}); * const foo = new aws.ec2.VpcPeeringConnection("foo", { * peerOwnerId: peerOwnerId, * peerVpcId: bar.id, * vpcId: fooVpc.id, * autoAccept: true, * tags: { * Name: "VPC Peering between foo and bar", * }, * }); * ``` * * Basic usage with region: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const fooVpc = new aws.ec2.Vpc("foo", {cidrBlock: "10.1.0.0/16"}); * const bar = new aws.ec2.Vpc("bar", {cidrBlock: "10.2.0.0/16"}); * const foo = new aws.ec2.VpcPeeringConnection("foo", { * peerOwnerId: peerOwnerId, * peerVpcId: bar.id, * vpcId: fooVpc.id, * peerRegion: "us-east-1", * }); * ``` * * ## Notes * * If both VPCs are not in the same AWS account and region do not enable the `autoAccept` attribute. * The accepter can manage its side of the connection using the `aws.ec2.VpcPeeringConnectionAccepter` resource * or accept the connection manually using the AWS Management Console, AWS CLI, through SDKs, etc. * * ## Import * * Using `pulumi import`, import VPC Peering resources using the VPC peering `id`. For example: * * ```sh * $ pulumi import aws:ec2/vpcPeeringConnection:VpcPeeringConnection test_connection pcx-111aaa111 * ``` */ class VpcPeeringConnection extends pulumi.CustomResource { /** * Get an existing VpcPeeringConnection 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 VpcPeeringConnection(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of VpcPeeringConnection. 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'] === VpcPeeringConnection.__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; } else { const args = argsOrState; if (args?.peerVpcId === undefined && !opts.urn) { throw new Error("Missing required property 'peerVpcId'"); } if (args?.vpcId === undefined && !opts.urn) { throw new Error("Missing required property 'vpcId'"); } resourceInputs["accepter"] = args?.accepter; resourceInputs["autoAccept"] = args?.autoAccept; resourceInputs["peerOwnerId"] = args?.peerOwnerId; resourceInputs["peerRegion"] = args?.peerRegion; resourceInputs["peerVpcId"] = args?.peerVpcId; resourceInputs["region"] = args?.region; resourceInputs["requester"] = args?.requester; resourceInputs["tags"] = args?.tags; resourceInputs["vpcId"] = args?.vpcId; resourceInputs["acceptStatus"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(VpcPeeringConnection.__pulumiType, name, resourceInputs, opts); } } exports.VpcPeeringConnection = VpcPeeringConnection; /** @internal */ VpcPeeringConnection.__pulumiType = 'aws:ec2/vpcPeeringConnection:VpcPeeringConnection'; //# sourceMappingURL=vpcPeeringConnection.js.map