Route Table Args
Provides a resource to create 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
andnat_gateway_id
: The AWS API is very forgiving with these two attributes and theaws.ec2.RouteTable
resource can be created with a NAT ID specified as a Gateway ID attribute. This will lead to a permanent diff between your configuration and statefile, as the API returns the correct parameters in the returned route table. If you're experiencing constant diffs in youraws.ec2.RouteTable
resources, the first thing to check is whether or not you're specifying a NAT ID instead of a Gateway ID, or vice-versa. NOTE onpropagating_vgws
and theaws.ec2.VpnGatewayRoutePropagation
resource: If thepropagating_vgws
argument is present, it's not supported to also define route propagations usingaws.ec2.VpnGatewayRoutePropagation
, since this resource will delete any propagating gateways not explicitly listed inpropagating_vgws
. Omit this argument when defining route propagation using the separate resource.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.RouteTable;
import com.pulumi.aws.ec2.RouteTableArgs;
import com.pulumi.aws.ec2.inputs.RouteTableRouteArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new RouteTable("example", RouteTableArgs.builder()
.vpcId(aws_vpc.example().id())
.routes(
RouteTableRouteArgs.builder()
.cidrBlock("10.0.1.0/24")
.gatewayId(aws_internet_gateway.example().id())
.build(),
RouteTableRouteArgs.builder()
.ipv6CidrBlock("::/0")
.egressOnlyGatewayId(aws_egress_only_internet_gateway.example().id())
.build())
.tags(Map.of("Name", "example"))
.build());
}
}
Import
Route Tables can be imported using the route table id
. For example, to import route table rtb-4e616f6d69
, use this command
$ pulumi import aws:ec2/routeTable:RouteTable public_rt rtb-4e616f6d69
Properties
A list of virtual gateways for propagation.
A list of route objects. Their keys are documented below. This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above.