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
new DefaultRouteTable(name: string, args: DefaultRouteTableArgs, opts?: CustomResourceOptions);
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)
func NewDefaultRouteTable(ctx *Context, name string, args DefaultRouteTableArgs, opts ...ResourceOption) (*DefaultRouteTable, error)
public DefaultRouteTable(string name, DefaultRouteTableArgs args, CustomResourceOptions? opts = null)
- 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:
- Default
Route stringTable Id The ID of the Default Routing Table.
- Propagating
Vgws List<string> A list of virtual gateways for propagation.
- Routes
List<Default
Route Table Route Args> A list of route objects. Their keys are documented below.
- Dictionary<string, string>
A mapping of tags to assign to the resource.
- Default
Route stringTable Id The ID of the Default Routing Table.
- Propagating
Vgws []string A list of virtual gateways for propagation.
- Routes
[]Default
Route Table Route A list of route objects. Their keys are documented below.
- map[string]string
A mapping of tags to assign to the resource.
- default
Route stringTable Id The ID of the Default Routing Table.
- propagating
Vgws string[] A list of virtual gateways for propagation.
- routes
Default
Route Table Route[] A list of route objects. Their keys are documented below.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- default_
route_ strtable_ id The ID of the Default Routing Table.
- propagating_
vgws Sequence[str] A list of virtual gateways for propagation.
- routes
Sequence[Default
Route Table Route Args] A list of route objects. Their keys are documented below.
- 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:
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:
- Default
Route stringTable Id The ID of the Default Routing Table.
- Owner
Id string The ID of the AWS account that owns the route table
- Propagating
Vgws List<string> A list of virtual gateways for propagation.
- Routes
List<Default
Route Table Route Args> A list of route objects. Their keys are documented below.
- Dictionary<string, string>
A mapping of tags to assign to the resource.
- Vpc
Id string
- Default
Route stringTable Id The ID of the Default Routing Table.
- Owner
Id string The ID of the AWS account that owns the route table
- Propagating
Vgws []string A list of virtual gateways for propagation.
- Routes
[]Default
Route Table Route A list of route objects. Their keys are documented below.
- map[string]string
A mapping of tags to assign to the resource.
- Vpc
Id string
- default
Route stringTable Id The ID of the Default Routing Table.
- owner
Id string The ID of the AWS account that owns the route table
- propagating
Vgws string[] A list of virtual gateways for propagation.
- routes
Default
Route Table Route[] A list of route objects. Their keys are documented below.
- {[key: string]: string}
A mapping of tags to assign to the resource.
- vpc
Id string
- default_
route_ strtable_ id 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[Default
Route Table Route Args] A list of route objects. Their keys are documented below.
- Mapping[str, str]
A mapping of tags to assign to the resource.
- vpc_
id str
Supporting Types
DefaultRouteTableRoute
- Cidr
Block string The CIDR block of the route.
- Egress
Only stringGateway Id Identifier of a VPC Egress Only Internet Gateway.
- Gateway
Id string Identifier of a VPC internet gateway or a virtual private gateway.
- Instance
Id string Identifier of an EC2 instance.
- Ipv6Cidr
Block string The Ipv6 CIDR block of the route
- Nat
Gateway stringId Identifier of a VPC NAT gateway.
- Network
Interface stringId Identifier of an EC2 network interface.
- Transit
Gateway stringId Identifier of an EC2 Transit Gateway.
- Vpc
Endpoint stringId Identifier of a VPC Endpoint. This route must be removed prior to VPC Endpoint deletion.
- Vpc
Peering stringConnection Id Identifier of a VPC peering connection.
- Cidr
Block string The CIDR block of the route.
- Egress
Only stringGateway Id Identifier of a VPC Egress Only Internet Gateway.
- Gateway
Id string Identifier of a VPC internet gateway or a virtual private gateway.
- Instance
Id string Identifier of an EC2 instance.
- Ipv6Cidr
Block string The Ipv6 CIDR block of the route
- Nat
Gateway stringId Identifier of a VPC NAT gateway.
- Network
Interface stringId Identifier of an EC2 network interface.
- Transit
Gateway stringId Identifier of an EC2 Transit Gateway.
- Vpc
Endpoint stringId Identifier of a VPC Endpoint. This route must be removed prior to VPC Endpoint deletion.
- Vpc
Peering stringConnection Id Identifier of a VPC peering connection.
- cidr
Block string The CIDR block of the route.
- egress
Only stringGateway Id Identifier of a VPC Egress Only Internet Gateway.
- gateway
Id string Identifier of a VPC internet gateway or a virtual private gateway.
- instance
Id string Identifier of an EC2 instance.
- ipv6Cidr
Block string The Ipv6 CIDR block of the route
- nat
Gateway stringId Identifier of a VPC NAT gateway.
- network
Interface stringId Identifier of an EC2 network interface.
- transit
Gateway stringId Identifier of an EC2 Transit Gateway.
- vpc
Endpoint stringId Identifier of a VPC Endpoint. This route must be removed prior to VPC Endpoint deletion.
- vpc
Peering stringConnection Id Identifier of a VPC peering connection.
- cidr_
block str The CIDR block of the route.
- egress_
only_ strgateway_ id 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_ strblock The Ipv6 CIDR block of the route
- nat_
gateway_ strid Identifier of a VPC NAT gateway.
- network_
interface_ strid Identifier of an EC2 network interface.
- transit_
gateway_ strid Identifier of an EC2 Transit Gateway.
- vpc_
endpoint_ strid Identifier of a VPC Endpoint. This route must be removed prior to VPC Endpoint deletion.
- vpc_
peering_ strconnection_ id Identifier of a VPC peering connection.
Import
Default VPC Routing tables can be imported using the vpc_id
, e.g.
$ pulumi import aws:ec2/defaultRouteTable:DefaultRouteTable example vpc-33cc44dd
[aws-route-tables]http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html#Route_Replacing_Main_Table [tf-route-tables]/docs/providers/aws/r/route_table.html
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.