@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
88 lines • 4.12 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.MainRouteTableAssociation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource for managing the main routing table of a VPC.
*
* > **NOTE:** **Do not** use both `aws.ec2.DefaultRouteTable` to manage a default route table **and** `aws.ec2.MainRouteTableAssociation` with the same VPC due to possible route conflicts. See aws.ec2.DefaultRouteTable documentation for more details.
* For more information, see the Amazon VPC User Guide on [Route Tables][aws-route-tables]. For information about managing normal route tables in Pulumi, see [`aws.ec2.RouteTable`][tf-route-tables].
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const a = new aws.ec2.MainRouteTableAssociation("a", {
* vpcId: foo.id,
* routeTableId: bar.id,
* });
* ```
*
* ## Notes
*
* On VPC creation, the AWS API always creates an initial Main Route Table. This
* resource records the ID of that Route Table under `originalRouteTableId`.
* The "Delete" action for a `mainRouteTableAssociation` consists of resetting
* this original table as the Main Route Table for the VPC. You'll see this
* additional Route Table in the AWS console; it must remain intact in order for
* the `mainRouteTableAssociation` delete to work properly.
*/
class MainRouteTableAssociation extends pulumi.CustomResource {
/**
* Get an existing MainRouteTableAssociation 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 MainRouteTableAssociation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of MainRouteTableAssociation. 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'] === MainRouteTableAssociation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["originalRouteTableId"] = state?.originalRouteTableId;
resourceInputs["region"] = state?.region;
resourceInputs["routeTableId"] = state?.routeTableId;
resourceInputs["vpcId"] = state?.vpcId;
}
else {
const args = argsOrState;
if (args?.routeTableId === undefined && !opts.urn) {
throw new Error("Missing required property 'routeTableId'");
}
if (args?.vpcId === undefined && !opts.urn) {
throw new Error("Missing required property 'vpcId'");
}
resourceInputs["region"] = args?.region;
resourceInputs["routeTableId"] = args?.routeTableId;
resourceInputs["vpcId"] = args?.vpcId;
resourceInputs["originalRouteTableId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(MainRouteTableAssociation.__pulumiType, name, resourceInputs, opts);
}
}
exports.MainRouteTableAssociation = MainRouteTableAssociation;
/** @internal */
MainRouteTableAssociation.__pulumiType = 'aws:ec2/mainRouteTableAssociation:MainRouteTableAssociation';
//# sourceMappingURL=mainRouteTableAssociation.js.map