MainRouteTableAssociation

Provides a resource for managing the main routing table of a VPC.

Notes

On VPC creation, the AWS API always creates an initial Main Route Table. This resource records the ID of that Route Table under original_route_table_id. The “Delete” action for a main_route_table_association consists of resetting this original table as the Main Route Table for the VPC. You’ll see this additional Route Table in the AWS console; it must remain intact in order for the main_route_table_association delete to work properly.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var mainRouteTableAssociation = new Aws.Ec2.MainRouteTableAssociation("mainRouteTableAssociation", new Aws.Ec2.MainRouteTableAssociationArgs
        {
            VpcId = aws_vpc.Foo.Id,
            RouteTableId = aws_route_table.Bar.Id,
        });
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.NewMainRouteTableAssociation(ctx, "mainRouteTableAssociation", &ec2.MainRouteTableAssociationArgs{
			VpcId:        pulumi.Any(aws_vpc.Foo.Id),
			RouteTableId: pulumi.Any(aws_route_table.Bar.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

main_route_table_association = aws.ec2.MainRouteTableAssociation("mainRouteTableAssociation",
    vpc_id=aws_vpc["foo"]["id"],
    route_table_id=aws_route_table["bar"]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const mainRouteTableAssociation = new aws.ec2.MainRouteTableAssociation("mainRouteTableAssociation", {
    vpcId: aws_vpc.foo.id,
    routeTableId: aws_route_table.bar.id,
});

Create a MainRouteTableAssociation Resource

new MainRouteTableAssociation(name: string, args: MainRouteTableAssociationArgs, opts?: CustomResourceOptions);
@overload
def MainRouteTableAssociation(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              route_table_id: Optional[str] = None,
                              vpc_id: Optional[str] = None)
@overload
def MainRouteTableAssociation(resource_name: str,
                              args: MainRouteTableAssociationArgs,
                              opts: Optional[ResourceOptions] = None)
func NewMainRouteTableAssociation(ctx *Context, name string, args MainRouteTableAssociationArgs, opts ...ResourceOption) (*MainRouteTableAssociation, error)
public MainRouteTableAssociation(string name, MainRouteTableAssociationArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args MainRouteTableAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args MainRouteTableAssociationArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args MainRouteTableAssociationArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args MainRouteTableAssociationArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

MainRouteTableAssociation Resource Properties

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

Inputs

The MainRouteTableAssociation resource accepts the following input properties:

RouteTableId string
The ID of the Route Table to set as the new main route table for the target VPC
VpcId string
The ID of the VPC whose main route table should be set
RouteTableId string
The ID of the Route Table to set as the new main route table for the target VPC
VpcId string
The ID of the VPC whose main route table should be set
routeTableId string
The ID of the Route Table to set as the new main route table for the target VPC
vpcId string
The ID of the VPC whose main route table should be set
route_table_id str
The ID of the Route Table to set as the new main route table for the target VPC
vpc_id str
The ID of the VPC whose main route table should be set

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
OriginalRouteTableId string
Used internally, see Notes below
Id string
The provider-assigned unique ID for this managed resource.
OriginalRouteTableId string
Used internally, see Notes below
id string
The provider-assigned unique ID for this managed resource.
originalRouteTableId string
Used internally, see Notes below
id str
The provider-assigned unique ID for this managed resource.
original_route_table_id str
Used internally, see Notes below

Look up an Existing MainRouteTableAssociation Resource

Get an existing MainRouteTableAssociation 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?: MainRouteTableAssociationState, opts?: CustomResourceOptions): MainRouteTableAssociation
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        original_route_table_id: Optional[str] = None,
        route_table_id: Optional[str] = None,
        vpc_id: Optional[str] = None) -> MainRouteTableAssociation
func GetMainRouteTableAssociation(ctx *Context, name string, id IDInput, state *MainRouteTableAssociationState, opts ...ResourceOption) (*MainRouteTableAssociation, error)
public static MainRouteTableAssociation Get(string name, Input<string> id, MainRouteTableAssociationState? 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:

OriginalRouteTableId string
Used internally, see Notes below
RouteTableId string
The ID of the Route Table to set as the new main route table for the target VPC
VpcId string
The ID of the VPC whose main route table should be set
OriginalRouteTableId string
Used internally, see Notes below
RouteTableId string
The ID of the Route Table to set as the new main route table for the target VPC
VpcId string
The ID of the VPC whose main route table should be set
originalRouteTableId string
Used internally, see Notes below
routeTableId string
The ID of the Route Table to set as the new main route table for the target VPC
vpcId string
The ID of the VPC whose main route table should be set
original_route_table_id str
Used internally, see Notes below
route_table_id str
The ID of the Route Table to set as the new main route table for the target VPC
vpc_id str
The ID of the VPC whose main route table should be set

Package Details

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