RouteTable
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_idandnat_gateway_id: The AWS API is very forgiving with these two attributes and theaws.ec2.RouteTableresource 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.RouteTableresources, the first thing to check is whether or not you’re specifying a NAT ID instead of a Gateway ID, or vice-versa.NOTE on
propagating_vgwsand theaws.ec2.VpnGatewayRoutePropagationresource: If thepropagating_vgwsargument 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
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var routeTable = new Aws.Ec2.RouteTable("routeTable", new Aws.Ec2.RouteTableArgs
{
Routes =
{
new Aws.Ec2.Inputs.RouteTableRouteArgs
{
CidrBlock = "10.0.1.0/24",
GatewayId = aws_internet_gateway.Main.Id,
},
new Aws.Ec2.Inputs.RouteTableRouteArgs
{
EgressOnlyGatewayId = aws_egress_only_internet_gateway.Foo.Id,
Ipv6CidrBlock = "::/0",
},
},
Tags =
{
{ "Name", "main" },
},
VpcId = aws_vpc.Default.Id,
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewRouteTable(ctx, "routeTable", &ec2.RouteTableArgs{
Routes: ec2.RouteTableRouteArray{
&ec2.RouteTableRouteArgs{
CidrBlock: pulumi.String("10.0.1.0/24"),
GatewayId: pulumi.String(aws_internet_gateway.Main.Id),
},
&ec2.RouteTableRouteArgs{
EgressOnlyGatewayId: pulumi.String(aws_egress_only_internet_gateway.Foo.Id),
Ipv6CidrBlock: pulumi.String("::/0"),
},
},
Tags: pulumi.StringMap{
"Name": pulumi.String("main"),
},
VpcId: pulumi.String(aws_vpc.Default.Id),
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
route_table = aws.ec2.RouteTable("routeTable",
routes=[
{
"cidr_block": "10.0.1.0/24",
"gateway_id": aws_internet_gateway["main"]["id"],
},
{
"egress_only_gateway_id": aws_egress_only_internet_gateway["foo"]["id"],
"ipv6_cidr_block": "::/0",
},
],
tags={
"Name": "main",
},
vpc_id=aws_vpc["default"]["id"])import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const routeTable = new aws.ec2.RouteTable("r", {
routes: [
{
cidrBlock: "10.0.1.0/24",
gatewayId: aws_internet_gateway_main.id,
},
{
egressOnlyGatewayId: aws_egress_only_internet_gateway_foo.id,
ipv6CidrBlock: "::/0",
},
],
tags: {
Name: "main",
},
vpcId: aws_vpc_default.id,
});Create a RouteTable Resource
new RouteTable(name: string, args: RouteTableArgs, opts?: CustomResourceOptions);def RouteTable(resource_name, opts=None, propagating_vgws=None, routes=None, tags=None, vpc_id=None, __props__=None);func NewRouteTable(ctx *Context, name string, args RouteTableArgs, opts ...ResourceOption) (*RouteTable, error)public RouteTable(string name, RouteTableArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args RouteTableArgs
- 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 RouteTableArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RouteTableArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
RouteTable Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The RouteTable resource accepts the following input properties:
- Vpc
Id string The VPC ID.
- Propagating
Vgws List<string> A list of virtual gateways for propagation.
- Routes
List<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 The VPC ID.
- Propagating
Vgws []string A list of virtual gateways for propagation.
- Routes
[]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 The VPC ID.
- propagating
Vgws string[] A list of virtual gateways for propagation.
- routes
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 str The VPC ID.
- propagating_
vgws List[str] A list of virtual gateways for propagation.
- routes
List[Route
Table Route] A list of route objects. Their keys are documented below.
- Dict[str, str]
A mapping of tags to assign to the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the RouteTable resource produces the following output properties:
Look up an Existing RouteTable Resource
Get an existing RouteTable 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?: RouteTableState, opts?: CustomResourceOptions): RouteTablestatic get(resource_name, id, opts=None, owner_id=None, propagating_vgws=None, routes=None, tags=None, vpc_id=None, __props__=None);func GetRouteTable(ctx *Context, name string, id IDInput, state *RouteTableState, opts ...ResourceOption) (*RouteTable, error)public static RouteTable Get(string name, Input<string> id, RouteTableState? 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:
- 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<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 The VPC ID.
- 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
[]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 The VPC ID.
- 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
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 The VPC ID.
- owner_
id str The ID of the AWS account that owns the route table.
- propagating_
vgws List[str] A list of virtual gateways for propagation.
- routes
List[Route
Table Route] A list of route objects. Their keys are documented below.
- Dict[str, str]
A mapping of tags to assign to the resource.
- vpc_
id str The VPC ID.
Supporting Types
RouteTableRoute
- 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
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
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
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_
peering_ strconnection_ id 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
awsTerraform Provider.