UNPKG

@pulumi/aws

Version:

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

124 lines 5.72 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.DefaultRouteTable = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides a resource to manage a default route table of a VPC. This resource can manage the default route table of the default or a non-default VPC. * * > **NOTE:** This is an advanced resource with special caveats. Please read this document in its entirety before using this resource. The `aws.ec2.DefaultRouteTable` resource behaves differently from normal resources. This provider does not _create_ this resource but instead attempts to "adopt" it into management. **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.MainRouteTableAssociation documentation for more details. * * Every VPC has a default route table that can be managed but not destroyed. When the provider first adopts a default route table, it **immediately removes all defined routes**. It then proceeds to create any routes specified in the configuration. This step is required so that only the routes specified in the configuration exist in the default route table. * * For more information, see the Amazon VPC User Guide on [Route Tables](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html). For information about managing normal route tables in this provider, see `aws.ec2.RouteTable`. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.ec2.DefaultRouteTable("example", { * defaultRouteTableId: exampleAwsVpc.defaultRouteTableId, * routes: [ * { * cidrBlock: "10.0.1.0/24", * gatewayId: exampleAwsInternetGateway.id, * }, * { * ipv6CidrBlock: "::/0", * egressOnlyGatewayId: exampleAwsEgressOnlyInternetGateway.id, * }, * ], * tags: { * Name: "example", * }, * }); * ``` * * To subsequently remove all managed routes: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const example = new aws.ec2.DefaultRouteTable("example", { * defaultRouteTableId: exampleAwsVpc.defaultRouteTableId, * routes: [], * tags: { * Name: "example", * }, * }); * ``` * * ## Import * * Using `pulumi import`, import Default VPC route tables using the `vpc_id`. For example: * * ```sh * $ pulumi import aws:ec2/defaultRouteTable:DefaultRouteTable example vpc-33cc44dd * ``` */ class DefaultRouteTable extends pulumi.CustomResource { /** * Get an existing DefaultRouteTable 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 DefaultRouteTable(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of DefaultRouteTable. 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'] === DefaultRouteTable.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["defaultRouteTableId"] = state?.defaultRouteTableId; resourceInputs["ownerId"] = state?.ownerId; resourceInputs["propagatingVgws"] = state?.propagatingVgws; resourceInputs["region"] = state?.region; resourceInputs["routes"] = state?.routes; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["vpcId"] = state?.vpcId; } else { const args = argsOrState; if (args?.defaultRouteTableId === undefined && !opts.urn) { throw new Error("Missing required property 'defaultRouteTableId'"); } resourceInputs["defaultRouteTableId"] = args?.defaultRouteTableId; resourceInputs["propagatingVgws"] = args?.propagatingVgws; resourceInputs["region"] = args?.region; resourceInputs["routes"] = args?.routes; resourceInputs["tags"] = args?.tags; resourceInputs["arn"] = undefined /*out*/; resourceInputs["ownerId"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; resourceInputs["vpcId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(DefaultRouteTable.__pulumiType, name, resourceInputs, opts); } } exports.DefaultRouteTable = DefaultRouteTable; /** @internal */ DefaultRouteTable.__pulumiType = 'aws:ec2/defaultRouteTable:DefaultRouteTable'; //# sourceMappingURL=defaultRouteTable.js.map