1. Packages
  2. AWS Classic
  3. API Docs
  4. ec2
  5. MainRouteTableAssociation

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

aws.ec2.MainRouteTableAssociation

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

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

    NOTE: Do not use both aws.ec2.DefaultRouteTable to manage a default route table and aws.ec2.MainRouteTableAssociation with the same VPC due to possible route conflicts. See aws.ec2.DefaultRouteTable documentation for more details. For more information, see the Amazon VPC User Guide on [Route Tables][aws-route-tables]. For information about managing normal route tables in Pulumi, see [aws.ec2.RouteTable][tf-route-tables].

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const a = new aws.ec2.MainRouteTableAssociation("a", {
        vpcId: foo.id,
        routeTableId: bar.id,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    a = aws.ec2.MainRouteTableAssociation("a",
        vpc_id=foo["id"],
        route_table_id=bar["id"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ec2.NewMainRouteTableAssociation(ctx, "a", &ec2.MainRouteTableAssociationArgs{
    			VpcId:        pulumi.Any(foo.Id),
    			RouteTableId: pulumi.Any(bar.Id),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var a = new Aws.Ec2.MainRouteTableAssociation("a", new()
        {
            VpcId = foo.Id,
            RouteTableId = bar.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ec2.MainRouteTableAssociation;
    import com.pulumi.aws.ec2.MainRouteTableAssociationArgs;
    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 a = new MainRouteTableAssociation("a", MainRouteTableAssociationArgs.builder()        
                .vpcId(foo.id())
                .routeTableId(bar.id())
                .build());
    
        }
    }
    
    resources:
      a:
        type: aws:ec2:MainRouteTableAssociation
        properties:
          vpcId: ${foo.id}
          routeTableId: ${bar.id}
    

    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.

    Create 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)
    public MainRouteTableAssociation(String name, MainRouteTableAssociationArgs args)
    public MainRouteTableAssociation(String name, MainRouteTableAssociationArgs args, CustomResourceOptions options)
    
    type: aws:ec2:MainRouteTableAssociation
    properties: # The arguments to resource properties.
    options: # 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.
    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.
    name String
    The unique name of the resource.
    args MainRouteTableAssociationArgs
    The arguments to resource properties.
    options 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 Architecture and Concepts 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
    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
    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

    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 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
    id String
    The provider-assigned unique ID for this managed resource.
    originalRouteTableId String
    Used internally, see Notes below

    Look up 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)
    public static MainRouteTableAssociation get(String name, Output<String> id, MainRouteTableAssociationState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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
    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
    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

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi