@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
101 lines • 3.84 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.RouteTableAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to create an association between a route table and a subnet or a route table and an
* internet gateway or virtual private gateway.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const a = new aws.ec2.RouteTableAssociation("a", {
* subnetId: foo.id,
* routeTableId: bar.id,
* });
* ```
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const b = new aws.ec2.RouteTableAssociation("b", {
* gatewayId: foo.id,
* routeTableId: bar.id,
* });
* ```
*
* ## Import
*
* With EC2 Internet Gateways:
*
* __Using `pulumi import` to import__ EC2 Route Table Associations using the associated resource ID and Route Table ID separated by a forward slash (`/`). For example:
*
* With EC2 Subnets:
*
* ```sh
* $ pulumi import aws:ec2/routeTableAssociation:RouteTableAssociation assoc subnet-6777656e646f6c796e/rtb-656c65616e6f72
* ```
* With EC2 Internet Gateways:
*
* ```sh
* $ pulumi import aws:ec2/routeTableAssociation:RouteTableAssociation assoc igw-01b3a60780f8d034a/rtb-656c65616e6f72
* ```
*/
class RouteTableAssociation extends pulumi.CustomResource {
/**
* Get an existing RouteTableAssociation 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 RouteTableAssociation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of RouteTableAssociation. 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'] === RouteTableAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["gatewayId"] = state?.gatewayId;
resourceInputs["region"] = state?.region;
resourceInputs["routeTableId"] = state?.routeTableId;
resourceInputs["subnetId"] = state?.subnetId;
}
else {
const args = argsOrState;
if (args?.routeTableId === undefined && !opts.urn) {
throw new Error("Missing required property 'routeTableId'");
}
resourceInputs["gatewayId"] = args?.gatewayId;
resourceInputs["region"] = args?.region;
resourceInputs["routeTableId"] = args?.routeTableId;
resourceInputs["subnetId"] = args?.subnetId;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(RouteTableAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.RouteTableAssociation = RouteTableAssociation;
/** @internal */
RouteTableAssociation.__pulumiType = 'aws:ec2/routeTableAssociation:RouteTableAssociation';
//# sourceMappingURL=routeTableAssociation.js.map