@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
148 lines • 6.45 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.GatewayAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Associates a Direct Connect Gateway with a VGW or transit gateway.
*
* To create a cross-account association, create an `aws.directconnect.GatewayAssociationProposal` resource
* in the AWS account that owns the VGW or transit gateway and then accept the proposal in the AWS account that owns the Direct Connect Gateway
* by creating an `aws.directconnect.GatewayAssociation` resource with the `proposalId` and `associatedGatewayOwnerAccountId` attributes set.
*
* ## Example Usage
*
* ### VPN Gateway Association
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.directconnect.Gateway("example", {
* name: "example",
* amazonSideAsn: "64512",
* });
* const exampleVpc = new aws.ec2.Vpc("example", {cidrBlock: "10.255.255.0/28"});
* const exampleVpnGateway = new aws.ec2.VpnGateway("example", {vpcId: exampleVpc.id});
* const exampleGatewayAssociation = new aws.directconnect.GatewayAssociation("example", {
* dxGatewayId: example.id,
* associatedGatewayId: exampleVpnGateway.id,
* });
* ```
*
* ### Transit Gateway Association
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.directconnect.Gateway("example", {
* name: "example",
* amazonSideAsn: "64512",
* });
* const exampleTransitGateway = new aws.ec2transitgateway.TransitGateway("example", {});
* const exampleGatewayAssociation = new aws.directconnect.GatewayAssociation("example", {
* dxGatewayId: example.id,
* associatedGatewayId: exampleTransitGateway.id,
* allowedPrefixes: [
* "10.255.255.0/30",
* "10.255.255.8/30",
* ],
* });
* ```
*
* ### Allowed Prefixes
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.directconnect.Gateway("example", {
* name: "example",
* amazonSideAsn: "64512",
* });
* const exampleVpc = new aws.ec2.Vpc("example", {cidrBlock: "10.255.255.0/28"});
* const exampleVpnGateway = new aws.ec2.VpnGateway("example", {vpcId: exampleVpc.id});
* const exampleGatewayAssociation = new aws.directconnect.GatewayAssociation("example", {
* dxGatewayId: example.id,
* associatedGatewayId: exampleVpnGateway.id,
* allowedPrefixes: [
* "210.52.109.0/24",
* "175.45.176.0/22",
* ],
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Direct Connect gateway associations using `dx_gateway_id` together with `associated_gateway_id`. For example:
*
* ```sh
* $ pulumi import aws:directconnect/gatewayAssociation:GatewayAssociation example 345508c3-7215-4aef-9832-07c125d5bd0f/vgw-98765432
* ```
*/
class GatewayAssociation extends pulumi.CustomResource {
/**
* Get an existing GatewayAssociation 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 GatewayAssociation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of GatewayAssociation. 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'] === GatewayAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["allowedPrefixes"] = state?.allowedPrefixes;
resourceInputs["associatedGatewayId"] = state?.associatedGatewayId;
resourceInputs["associatedGatewayOwnerAccountId"] = state?.associatedGatewayOwnerAccountId;
resourceInputs["associatedGatewayType"] = state?.associatedGatewayType;
resourceInputs["dxGatewayAssociationId"] = state?.dxGatewayAssociationId;
resourceInputs["dxGatewayId"] = state?.dxGatewayId;
resourceInputs["dxGatewayOwnerAccountId"] = state?.dxGatewayOwnerAccountId;
resourceInputs["proposalId"] = state?.proposalId;
resourceInputs["region"] = state?.region;
resourceInputs["transitGatewayAttachmentId"] = state?.transitGatewayAttachmentId;
}
else {
const args = argsOrState;
if (args?.dxGatewayId === undefined && !opts.urn) {
throw new Error("Missing required property 'dxGatewayId'");
}
resourceInputs["allowedPrefixes"] = args?.allowedPrefixes;
resourceInputs["associatedGatewayId"] = args?.associatedGatewayId;
resourceInputs["associatedGatewayOwnerAccountId"] = args?.associatedGatewayOwnerAccountId;
resourceInputs["dxGatewayId"] = args?.dxGatewayId;
resourceInputs["proposalId"] = args?.proposalId;
resourceInputs["region"] = args?.region;
resourceInputs["associatedGatewayType"] = undefined /*out*/;
resourceInputs["dxGatewayAssociationId"] = undefined /*out*/;
resourceInputs["dxGatewayOwnerAccountId"] = undefined /*out*/;
resourceInputs["transitGatewayAttachmentId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GatewayAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.GatewayAssociation = GatewayAssociation;
/** @internal */
GatewayAssociation.__pulumiType = 'aws:directconnect/gatewayAssociation:GatewayAssociation';
//# sourceMappingURL=gatewayAssociation.js.map
;