@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
192 lines • 8.49 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.Route = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides a resource to create a routing table entry (a route) in a VPC routing table.
*
* > **NOTE on `gatewayId` attribute:** The AWS API is very forgiving with the resource ID passed in the `gatewayId` attribute. For example an `aws.ec2.Route` resource can be created with an `aws.ec2.NatGateway` or `aws.ec2.EgressOnlyInternetGateway` ID specified for the `gatewayId` attribute. Specifying anything other than an `aws.ec2.InternetGateway` or `aws.ec2.VpnGateway` ID will lead to this provider reporting a permanent diff between your configuration and recorded state, as the AWS API returns the more-specific attribute. If you are experiencing constant diffs with an `aws.ec2.Route` resource, the first thing to check is that the correct attribute is being specified.
*
* > **NOTE on combining `vpcEndpointId` and `destinationPrefixListId` attributes:** To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use the `aws.ec2.VpcEndpointRouteTableAssociation` resource instead.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const r = new aws.ec2.Route("r", {
* routeTableId: testing.id,
* destinationCidrBlock: "10.0.1.0/22",
* vpcPeeringConnectionId: "pcx-45ff3dc1",
* });
* ```
*
* ## Example IPv6 Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const vpc = new aws.ec2.Vpc("vpc", {
* cidrBlock: "10.1.0.0/16",
* assignGeneratedIpv6CidrBlock: true,
* });
* const egress = new aws.ec2.EgressOnlyInternetGateway("egress", {vpcId: vpc.id});
* const r = new aws.ec2.Route("r", {
* routeTableId: "rtb-4fbb3ac4",
* destinationIpv6CidrBlock: "::/0",
* egressOnlyGatewayId: egress.id,
* });
* ```
*
* ## Import
*
* ### Identity Schema
*
* #### Required
*
* * `route_table_id` - (String) ID of the route table.
*
* #### Optional
*
* ~> Exactly one of of `destination_cidr_block`, `destination_ipv6_cidr_block`, or `destination_prefix_list_id` is required.
*
* * `account_id` (String) AWS Account where this resource is managed.
*
* * `destination_cidr_block` - (String) Destination IPv4 CIDR block.
*
* * `destination_ipv6_cidr_block` - (String) Destination IPv6 CIDR block.
*
* * `destination_prefix_list_id` - (String) Destination IPv6 CIDR block.
*
* * `region` (String) Region where this resource is managed.
*
* Import a route in route table `rtb-656C65616E6F72` with an IPv6 destination CIDR of `2620:0:2d0:200::8/125`:
*
* terraform
*
* import {
*
* to = aws_route.my_route
*
* id = "rtb-656C65616E6F72_2620:0:2d0:200::8/125"
*
* }
*
* Import a route in route table `rtb-656C65616E6F72` with a managed prefix list destination of `pl-0570a1d2d725c16be`:
*
* terraform
*
* import {
*
* to = aws_route.my_route
*
* id = "rtb-656C65616E6F72_pl-0570a1d2d725c16be"
*
* }
*
* **Using `pulumi import` to import** individual routes using `ROUTETABLEID_DESTINATION`. Import [local routes](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Route_Tables.html#RouteTables) using the VPC's IPv4 or IPv6 CIDR blocks. For example:
*
* Import a route in route table `rtb-656C65616E6F72` with an IPv4 destination CIDR of `10.42.0.0/16`:
*
* console
*
* % pulumi import aws_route.my_route rtb-656C65616E6F72_10.42.0.0/16
*
* Import a route in route table `rtb-656C65616E6F72` with an IPv6 destination CIDR of `2620:0:2d0:200::8/125`:
*
* console
*
* % pulumi import aws_route.my_route rtb-656C65616E6F72_2620:0:2d0:200::8/125
*
* Import a route in route table `rtb-656C65616E6F72` with a managed prefix list destination of `pl-0570a1d2d725c16be`:
*
* console
*
* % pulumi import aws_route.my_route rtb-656C65616E6F72_pl-0570a1d2d725c16be
*/
class Route extends pulumi.CustomResource {
/**
* Get an existing Route 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 Route(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Route. 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'] === Route.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["carrierGatewayId"] = state?.carrierGatewayId;
resourceInputs["coreNetworkArn"] = state?.coreNetworkArn;
resourceInputs["destinationCidrBlock"] = state?.destinationCidrBlock;
resourceInputs["destinationIpv6CidrBlock"] = state?.destinationIpv6CidrBlock;
resourceInputs["destinationPrefixListId"] = state?.destinationPrefixListId;
resourceInputs["egressOnlyGatewayId"] = state?.egressOnlyGatewayId;
resourceInputs["gatewayId"] = state?.gatewayId;
resourceInputs["instanceId"] = state?.instanceId;
resourceInputs["instanceOwnerId"] = state?.instanceOwnerId;
resourceInputs["localGatewayId"] = state?.localGatewayId;
resourceInputs["natGatewayId"] = state?.natGatewayId;
resourceInputs["networkInterfaceId"] = state?.networkInterfaceId;
resourceInputs["origin"] = state?.origin;
resourceInputs["region"] = state?.region;
resourceInputs["routeTableId"] = state?.routeTableId;
resourceInputs["state"] = state?.state;
resourceInputs["transitGatewayId"] = state?.transitGatewayId;
resourceInputs["vpcEndpointId"] = state?.vpcEndpointId;
resourceInputs["vpcPeeringConnectionId"] = state?.vpcPeeringConnectionId;
}
else {
const args = argsOrState;
if (args?.routeTableId === undefined && !opts.urn) {
throw new Error("Missing required property 'routeTableId'");
}
resourceInputs["carrierGatewayId"] = args?.carrierGatewayId;
resourceInputs["coreNetworkArn"] = args?.coreNetworkArn;
resourceInputs["destinationCidrBlock"] = args?.destinationCidrBlock;
resourceInputs["destinationIpv6CidrBlock"] = args?.destinationIpv6CidrBlock;
resourceInputs["destinationPrefixListId"] = args?.destinationPrefixListId;
resourceInputs["egressOnlyGatewayId"] = args?.egressOnlyGatewayId;
resourceInputs["gatewayId"] = args?.gatewayId;
resourceInputs["localGatewayId"] = args?.localGatewayId;
resourceInputs["natGatewayId"] = args?.natGatewayId;
resourceInputs["networkInterfaceId"] = args?.networkInterfaceId;
resourceInputs["region"] = args?.region;
resourceInputs["routeTableId"] = args?.routeTableId;
resourceInputs["transitGatewayId"] = args?.transitGatewayId;
resourceInputs["vpcEndpointId"] = args?.vpcEndpointId;
resourceInputs["vpcPeeringConnectionId"] = args?.vpcPeeringConnectionId;
resourceInputs["instanceId"] = undefined /*out*/;
resourceInputs["instanceOwnerId"] = undefined /*out*/;
resourceInputs["origin"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Route.__pulumiType, name, resourceInputs, opts);
}
}
exports.Route = Route;
/** @internal */
Route.__pulumiType = 'aws:ec2/route:Route';
//# sourceMappingURL=route.js.map