@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
112 lines • 4.95 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.PeeringAttachment = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages an EC2 Transit Gateway Peering Attachment.
* For examples of custom route table association and propagation, see the [EC2 Transit Gateway Networking Examples Guide](https://docs.aws.amazon.com/vpc/latest/tgw/TGW_Scenarios.html).
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const peer = aws.getRegion({});
* const local = new aws.ec2transitgateway.TransitGateway("local", {tags: {
* Name: "Local TGW",
* }});
* const peerTransitGateway = new aws.ec2transitgateway.TransitGateway("peer", {tags: {
* Name: "Peer TGW",
* }});
* const example = new aws.ec2transitgateway.PeeringAttachment("example", {
* peerAccountId: peerTransitGateway.ownerId,
* peerRegion: peer.then(peer => peer.name),
* peerTransitGatewayId: peerTransitGateway.id,
* transitGatewayId: local.id,
* tags: {
* Name: "TGW Peering Requestor",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import `aws_ec2_transit_gateway_peering_attachment` using the EC2 Transit Gateway Attachment identifier. For example:
*
* ```sh
* $ pulumi import aws:ec2transitgateway/peeringAttachment:PeeringAttachment example tgw-attach-12345678
* ```
*/
class PeeringAttachment extends pulumi.CustomResource {
/**
* Get an existing PeeringAttachment 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 PeeringAttachment(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of PeeringAttachment. 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'] === PeeringAttachment.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["options"] = state?.options;
resourceInputs["peerAccountId"] = state?.peerAccountId;
resourceInputs["peerRegion"] = state?.peerRegion;
resourceInputs["peerTransitGatewayId"] = state?.peerTransitGatewayId;
resourceInputs["region"] = state?.region;
resourceInputs["state"] = state?.state;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["transitGatewayId"] = state?.transitGatewayId;
}
else {
const args = argsOrState;
if (args?.peerRegion === undefined && !opts.urn) {
throw new Error("Missing required property 'peerRegion'");
}
if (args?.peerTransitGatewayId === undefined && !opts.urn) {
throw new Error("Missing required property 'peerTransitGatewayId'");
}
if (args?.transitGatewayId === undefined && !opts.urn) {
throw new Error("Missing required property 'transitGatewayId'");
}
resourceInputs["options"] = args?.options;
resourceInputs["peerAccountId"] = args?.peerAccountId;
resourceInputs["peerRegion"] = args?.peerRegion;
resourceInputs["peerTransitGatewayId"] = args?.peerTransitGatewayId;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["transitGatewayId"] = args?.transitGatewayId;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(PeeringAttachment.__pulumiType, name, resourceInputs, opts);
}
}
exports.PeeringAttachment = PeeringAttachment;
/** @internal */
PeeringAttachment.__pulumiType = 'aws:ec2transitgateway/peeringAttachment:PeeringAttachment';
//# sourceMappingURL=peeringAttachment.js.map
;