pulumi_wasm_providers_aws_mini::ec2

Module route

source
Expand description

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 gateway_id attribute: The AWS API is very forgiving with the resource ID passed in the gateway_id attribute. For example an aws.ec2.Route resource can be created with an aws.ec2.NatGateway or aws.ec2.EgressOnlyInternetGateway ID specified for the gateway_id 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 vpc_endpoint_id and destination_prefix_list_id attributes: To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use the aws.ec2.VpcEndpointRouteTableAssociation resource instead.

§Example Usage

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let r = route::create(
        "r",
        RouteArgs::builder()
            .destination_cidr_block("10.0.1.0/22")
            .route_table_id("${testing.id}")
            .vpc_peering_connection_id("pcx-45ff3dc1")
            .build_struct(),
    );
}

§Example IPv6 Usage

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let egress = egress_only_internet_gateway::create(
        "egress",
        EgressOnlyInternetGatewayArgs::builder().vpc_id("${vpc.id}").build_struct(),
    );
    let r = route::create(
        "r",
        RouteArgs::builder()
            .destination_ipv_6_cidr_block("::/0")
            .egress_only_gateway_id("${egress.id}")
            .route_table_id("rtb-4fbb3ac4")
            .build_struct(),
    );
    let vpc = vpc::create(
        "vpc",
        VpcArgs::builder()
            .assign_generated_ipv_6_cidr_block(true)
            .cidr_block("10.1.0.0/16")
            .build_struct(),
    );
}

§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 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:

$ 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:

$ 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:

$ pulumi import aws:ec2/route:Route my_route rtb-656C65616E6F72_pl-0570a1d2d725c16be

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments