UNPKG

@pulumi/aws

Version:

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

152 lines 8.66 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.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 Route Tables and Routes:** This provider currently provides both a standalone Route resource and a Route Table resource with routes defined in-line. At this time you cannot use a Route Table with in-line routes in conjunction with any Route resources. Doing so will cause a conflict of rule settings and will overwrite rules. * * > **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 * * Import a route in route table `rtb-656C65616E6F72` with an IPv6 destination CIDR of `2620:0:2d0:200::8/125`: * * Import a route in route table `rtb-656C65616E6F72` with a managed prefix list destination of `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`: * * ```sh * $ pulumi import aws:ec2/route: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`: * * ```sh * $ pulumi import aws:ec2/route: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`: * * ```sh * $ pulumi import aws:ec2/route: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, Object.assign(Object.assign({}, 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 ? state.carrierGatewayId : undefined; resourceInputs["coreNetworkArn"] = state ? state.coreNetworkArn : undefined; resourceInputs["destinationCidrBlock"] = state ? state.destinationCidrBlock : undefined; resourceInputs["destinationIpv6CidrBlock"] = state ? state.destinationIpv6CidrBlock : undefined; resourceInputs["destinationPrefixListId"] = state ? state.destinationPrefixListId : undefined; resourceInputs["egressOnlyGatewayId"] = state ? state.egressOnlyGatewayId : undefined; resourceInputs["gatewayId"] = state ? state.gatewayId : undefined; resourceInputs["instanceId"] = state ? state.instanceId : undefined; resourceInputs["instanceOwnerId"] = state ? state.instanceOwnerId : undefined; resourceInputs["localGatewayId"] = state ? state.localGatewayId : undefined; resourceInputs["natGatewayId"] = state ? state.natGatewayId : undefined; resourceInputs["networkInterfaceId"] = state ? state.networkInterfaceId : undefined; resourceInputs["origin"] = state ? state.origin : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["routeTableId"] = state ? state.routeTableId : undefined; resourceInputs["state"] = state ? state.state : undefined; resourceInputs["transitGatewayId"] = state ? state.transitGatewayId : undefined; resourceInputs["vpcEndpointId"] = state ? state.vpcEndpointId : undefined; resourceInputs["vpcPeeringConnectionId"] = state ? state.vpcPeeringConnectionId : undefined; } else { const args = argsOrState; if ((!args || args.routeTableId === undefined) && !opts.urn) { throw new Error("Missing required property 'routeTableId'"); } resourceInputs["carrierGatewayId"] = args ? args.carrierGatewayId : undefined; resourceInputs["coreNetworkArn"] = args ? args.coreNetworkArn : undefined; resourceInputs["destinationCidrBlock"] = args ? args.destinationCidrBlock : undefined; resourceInputs["destinationIpv6CidrBlock"] = args ? args.destinationIpv6CidrBlock : undefined; resourceInputs["destinationPrefixListId"] = args ? args.destinationPrefixListId : undefined; resourceInputs["egressOnlyGatewayId"] = args ? args.egressOnlyGatewayId : undefined; resourceInputs["gatewayId"] = args ? args.gatewayId : undefined; resourceInputs["localGatewayId"] = args ? args.localGatewayId : undefined; resourceInputs["natGatewayId"] = args ? args.natGatewayId : undefined; resourceInputs["networkInterfaceId"] = args ? args.networkInterfaceId : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["routeTableId"] = args ? args.routeTableId : undefined; resourceInputs["transitGatewayId"] = args ? args.transitGatewayId : undefined; resourceInputs["vpcEndpointId"] = args ? args.vpcEndpointId : undefined; resourceInputs["vpcPeeringConnectionId"] = args ? args.vpcPeeringConnectionId : undefined; 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