Come join Pulumi for the industry's first Cloud Engineering Summit! October 7–8. Save Your Spot

DefaultRouteTable

Provides a resource to manage a Default VPC Routing Table.

Each VPC created in AWS comes with a Default Route Table that can be managed, but not destroyed. This is an advanced resource, and has special caveats to be aware of when using it. Please read this document in its entirety before using this resource. It is recommended you do not use both aws.ec2.DefaultRouteTable to manage the default route table and use the aws.ec2.MainRouteTableAssociation, due to possible conflict in routes.

The aws.ec2.DefaultRouteTable behaves differently from normal resources, in that this provider does not create this resource, but instead attempts to “adopt” it into management. We can do this because each VPC created has a Default Route Table that cannot be destroyed, and is created with a single route.

When this provider first adopts the 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 present in the Default Route Table.

For more information about Route Tables, see the AWS Documentation on [Route Tables][aws-route-tables].

For more information about managing normal Route Tables in this provider, see our documentation on [aws.ec2.RouteTable][tf-route-tables].

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 routes.

Example Usage

With Tags

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var defaultRouteTable = new Aws.Ec2.DefaultRouteTable("defaultRouteTable", new Aws.Ec2.DefaultRouteTableArgs
        {
            DefaultRouteTableId = aws_vpc.Foo.Default_route_table_id,
            Routes = 
            {
                ,
            },
            Tags = 
            {
                { "Name", "default table" },
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v3/go/aws/ec2"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := ec2.NewDefaultRouteTable(ctx, "defaultRouteTable", &ec2.DefaultRouteTableArgs{
            DefaultRouteTableId: pulumi.Any(aws_vpc.Foo.Default_route_table_id),
            Routes: ec2.DefaultRouteTableRouteArray{
                nil,
            },
            Tags: pulumi.StringMap{
                "Name": pulumi.String("default table"),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

default_route_table = aws.ec2.DefaultRouteTable("defaultRouteTable",
    default_route_table_id=aws_vpc["foo"]["default_route_table_id"],
    routes=[aws.ec2.DefaultRouteTableRouteArgs()],
    tags={
        "Name": "default table",
    })
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const defaultRouteTable = new aws.ec2.DefaultRouteTable("defaultRouteTable", {
    defaultRouteTableId: aws_vpc.foo.default_route_table_id,
    routes: [{}],
    tags: {
        Name: "default table",
    },
});

Create a DefaultRouteTable Resource

def DefaultRouteTable(resource_name: str, opts: Optional[ResourceOptions] = None, default_route_table_id: Optional[str] = None, propagating_vgws: Optional[Sequence[str]] = None, routes: Optional[Sequence[DefaultRouteTableRouteArgs]] = None, tags: Optional[Mapping[str, str]] = None)
name string
The unique name of the resource.
args DefaultRouteTableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DefaultRouteTableArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DefaultRouteTableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

DefaultRouteTable Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The DefaultRouteTable resource accepts the following input properties:

DefaultRouteTableId string

The ID of the Default Routing Table.

PropagatingVgws List<string>

A list of virtual gateways for propagation.

Routes List<DefaultRouteTableRouteArgs>

A list of route objects. Their keys are documented below.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

DefaultRouteTableId string

The ID of the Default Routing Table.

PropagatingVgws []string

A list of virtual gateways for propagation.

Routes []DefaultRouteTableRoute

A list of route objects. Their keys are documented below.

Tags map[string]string

A mapping of tags to assign to the resource.

defaultRouteTableId string

The ID of the Default Routing Table.

propagatingVgws string[]

A list of virtual gateways for propagation.

routes DefaultRouteTableRoute[]

A list of route objects. Their keys are documented below.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

default_route_table_id str

The ID of the Default Routing Table.

propagating_vgws Sequence[str]

A list of virtual gateways for propagation.

routes Sequence[DefaultRouteTableRouteArgs]

A list of route objects. Their keys are documented below.

tags Mapping[str, str]

A mapping of tags to assign to the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the DefaultRouteTable resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
OwnerId string

The ID of the AWS account that owns the route table

VpcId string
Id string
The provider-assigned unique ID for this managed resource.
OwnerId string

The ID of the AWS account that owns the route table

VpcId string
id string
The provider-assigned unique ID for this managed resource.
ownerId string

The ID of the AWS account that owns the route table

vpcId string
id str
The provider-assigned unique ID for this managed resource.
owner_id str

The ID of the AWS account that owns the route table

vpc_id str

Look up an Existing DefaultRouteTable Resource

Get an existing DefaultRouteTable resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DefaultRouteTableState, opts?: CustomResourceOptions): DefaultRouteTable
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, default_route_table_id: Optional[str] = None, owner_id: Optional[str] = None, propagating_vgws: Optional[Sequence[str]] = None, routes: Optional[Sequence[DefaultRouteTableRouteArgs]] = None, tags: Optional[Mapping[str, str]] = None, vpc_id: Optional[str] = None) -> DefaultRouteTable
func GetDefaultRouteTable(ctx *Context, name string, id IDInput, state *DefaultRouteTableState, opts ...ResourceOption) (*DefaultRouteTable, error)
public static DefaultRouteTable Get(string name, Input<string> id, DefaultRouteTableState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

DefaultRouteTableId string

The ID of the Default Routing Table.

OwnerId string

The ID of the AWS account that owns the route table

PropagatingVgws List<string>

A list of virtual gateways for propagation.

Routes List<DefaultRouteTableRouteArgs>

A list of route objects. Their keys are documented below.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

VpcId string
DefaultRouteTableId string

The ID of the Default Routing Table.

OwnerId string

The ID of the AWS account that owns the route table

PropagatingVgws []string

A list of virtual gateways for propagation.

Routes []DefaultRouteTableRoute

A list of route objects. Their keys are documented below.

Tags map[string]string

A mapping of tags to assign to the resource.

VpcId string
defaultRouteTableId string

The ID of the Default Routing Table.

ownerId string

The ID of the AWS account that owns the route table

propagatingVgws string[]

A list of virtual gateways for propagation.

routes DefaultRouteTableRoute[]

A list of route objects. Their keys are documented below.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

vpcId string
default_route_table_id str

The ID of the Default Routing Table.

owner_id str

The ID of the AWS account that owns the route table

propagating_vgws Sequence[str]

A list of virtual gateways for propagation.

routes Sequence[DefaultRouteTableRouteArgs]

A list of route objects. Their keys are documented below.

tags Mapping[str, str]

A mapping of tags to assign to the resource.

vpc_id str

Supporting Types

DefaultRouteTableRoute

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

CidrBlock string

The CIDR block of the route.

EgressOnlyGatewayId string

Identifier of a VPC Egress Only Internet Gateway.

GatewayId string

Identifier of a VPC internet gateway or a virtual private gateway.

InstanceId string

Identifier of an EC2 instance.

Ipv6CidrBlock string

The Ipv6 CIDR block of the route

NatGatewayId string

Identifier of a VPC NAT gateway.

NetworkInterfaceId string

Identifier of an EC2 network interface.

TransitGatewayId string

Identifier of an EC2 Transit Gateway.

VpcPeeringConnectionId string

Identifier of a VPC peering connection.

CidrBlock string

The CIDR block of the route.

EgressOnlyGatewayId string

Identifier of a VPC Egress Only Internet Gateway.

GatewayId string

Identifier of a VPC internet gateway or a virtual private gateway.

InstanceId string

Identifier of an EC2 instance.

Ipv6CidrBlock string

The Ipv6 CIDR block of the route

NatGatewayId string

Identifier of a VPC NAT gateway.

NetworkInterfaceId string

Identifier of an EC2 network interface.

TransitGatewayId string

Identifier of an EC2 Transit Gateway.

VpcPeeringConnectionId string

Identifier of a VPC peering connection.

cidrBlock string

The CIDR block of the route.

egressOnlyGatewayId string

Identifier of a VPC Egress Only Internet Gateway.

gatewayId string

Identifier of a VPC internet gateway or a virtual private gateway.

instanceId string

Identifier of an EC2 instance.

ipv6CidrBlock string

The Ipv6 CIDR block of the route

natGatewayId string

Identifier of a VPC NAT gateway.

networkInterfaceId string

Identifier of an EC2 network interface.

transitGatewayId string

Identifier of an EC2 Transit Gateway.

vpcPeeringConnectionId string

Identifier of a VPC peering connection.

cidr_block str

The CIDR block of the route.

egress_only_gateway_id str

Identifier of a VPC Egress Only Internet Gateway.

gateway_id str

Identifier of a VPC internet gateway or a virtual private gateway.

instance_id str

Identifier of an EC2 instance.

ipv6_cidr_block str

The Ipv6 CIDR block of the route

nat_gateway_id str

Identifier of a VPC NAT gateway.

network_interface_id str

Identifier of an EC2 network interface.

transit_gateway_id str

Identifier of an EC2 Transit Gateway.

vpc_peering_connection_id str

Identifier of a VPC peering connection.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.