Default Route Table Args
Provides a resource to manage a default route table of a VPC. This resource can manage the default route table of the default or a non-default VPC.
NOTE: This is an advanced resource with special caveats. Please read this document in its entirety before using this resource. The
aws.ec2.DefaultRouteTable
resource behaves differently from normal resources. This provider does not create this resource but instead attempts to "adopt" it into management. Do not use bothaws.ec2.DefaultRouteTable
to manage a default route table andaws.ec2.MainRouteTableAssociation
with the same VPC due to possible route conflicts. See aws.ec2.MainRouteTableAssociation documentation for more details. Every VPC has a default route table that can be managed but not destroyed. When the provider first adopts a default route table, it immediately removes all defined routes. It then proceeds to create any routes specified in the configuration. This step is required so that only the routes specified in the configuration exist in the default route table. For more information, see the Amazon VPC User Guide on Route Tables. For information about managing normal route tables in this provider, seeaws.ec2.RouteTable
.
Example Usage
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.DefaultRouteTable;
import com.pulumi.aws.ec2.DefaultRouteTableArgs;
import com.pulumi.aws.ec2.inputs.DefaultRouteTableRouteArgs;
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 DefaultRouteTable("example", DefaultRouteTableArgs.builder()
.defaultRouteTableId(aws_vpc.example().default_route_table_id())
.routes(
DefaultRouteTableRouteArgs.builder()
.cidrBlock("10.0.1.0/24")
.gatewayId(aws_internet_gateway.example().id())
.build(),
DefaultRouteTableRouteArgs.builder()
.ipv6CidrBlock("::/0")
.egressOnlyGatewayId(aws_egress_only_internet_gateway.example().id())
.build())
.tags(Map.of("Name", "example"))
.build());
}
}
Import
Default VPC route tables can be imported using the vpc_id
, e.g.,
$ pulumi import aws:ec2/defaultRouteTable:DefaultRouteTable example vpc-33cc44dd