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 thegateway_id
attribute. For example anaws.ec2.Route
resource can be created with anaws.ec2.NatGateway
oraws.ec2.EgressOnlyInternetGateway
ID specified for thegateway_id
attribute. Specifying anything other than anaws.ec2.InternetGateway
oraws.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 anaws.ec2.Route
resource, the first thing to check is that the correct attribute is being specified.
NOTE on combining
vpc_endpoint_id
anddestination_prefix_list_id
attributes: To associate a Gateway VPC Endpoint (such as S3) with destination prefix list, use theaws.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§
- Use builder syntax to set the inputs and finish with
build_struct()
.
Functions§
- Registers a new resource with the given unique name and arguments