aws.ec2.MainRouteTableAssociation
Explore with Pulumi AI
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 andaws.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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MainRouteTableAssociation(name: string, args: MainRouteTableAssociationArgs, opts?: CustomResourceOptions);
@overload
def MainRouteTableAssociation(resource_name: str,
args: MainRouteTableAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MainRouteTableAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
route_table_id: Optional[str] = None,
vpc_id: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var mainRouteTableAssociationResource = new Aws.Ec2.MainRouteTableAssociation("mainRouteTableAssociationResource", new()
{
RouteTableId = "string",
VpcId = "string",
});
example, err := ec2.NewMainRouteTableAssociation(ctx, "mainRouteTableAssociationResource", &ec2.MainRouteTableAssociationArgs{
RouteTableId: pulumi.String("string"),
VpcId: pulumi.String("string"),
})
var mainRouteTableAssociationResource = new MainRouteTableAssociation("mainRouteTableAssociationResource", MainRouteTableAssociationArgs.builder()
.routeTableId("string")
.vpcId("string")
.build());
main_route_table_association_resource = aws.ec2.MainRouteTableAssociation("mainRouteTableAssociationResource",
route_table_id="string",
vpc_id="string")
const mainRouteTableAssociationResource = new aws.ec2.MainRouteTableAssociation("mainRouteTableAssociationResource", {
routeTableId: "string",
vpcId: "string",
});
type: aws:ec2:MainRouteTableAssociation
properties:
routeTableId: string
vpcId: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The MainRouteTableAssociation resource accepts the following input properties:
- Route
Table stringId - The ID of the Route Table to set as the new main route table for the target VPC
- Vpc
Id string - The ID of the VPC whose main route table should be set
- Route
Table stringId - The ID of the Route Table to set as the new main route table for the target VPC
- Vpc
Id string - The ID of the VPC whose main route table should be set
- route
Table StringId - The ID of the Route Table to set as the new main route table for the target VPC
- vpc
Id String - The ID of the VPC whose main route table should be set
- route
Table stringId - The ID of the Route Table to set as the new main route table for the target VPC
- vpc
Id string - The ID of the VPC whose main route table should be set
- route_
table_ strid - 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
- route
Table StringId - The ID of the Route Table to set as the new main route table for the target VPC
- vpc
Id 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.
- Original
Route stringTable Id - Used internally, see Notes below
- Id string
- The provider-assigned unique ID for this managed resource.
- Original
Route stringTable Id - Used internally, see Notes below
- id String
- The provider-assigned unique ID for this managed resource.
- original
Route StringTable Id - Used internally, see Notes below
- id string
- The provider-assigned unique ID for this managed resource.
- original
Route stringTable Id - Used internally, see Notes below
- id str
- The provider-assigned unique ID for this managed resource.
- original_
route_ strtable_ id - Used internally, see Notes below
- id String
- The provider-assigned unique ID for this managed resource.
- original
Route StringTable Id - 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.
- Original
Route stringTable Id - Used internally, see Notes below
- Route
Table stringId - The ID of the Route Table to set as the new main route table for the target VPC
- Vpc
Id string - The ID of the VPC whose main route table should be set
- Original
Route stringTable Id - Used internally, see Notes below
- Route
Table stringId - The ID of the Route Table to set as the new main route table for the target VPC
- Vpc
Id string - The ID of the VPC whose main route table should be set
- original
Route StringTable Id - Used internally, see Notes below
- route
Table StringId - The ID of the Route Table to set as the new main route table for the target VPC
- vpc
Id String - The ID of the VPC whose main route table should be set
- original
Route stringTable Id - Used internally, see Notes below
- route
Table stringId - The ID of the Route Table to set as the new main route table for the target VPC
- vpc
Id string - The ID of the VPC whose main route table should be set
- original_
route_ strtable_ id - Used internally, see Notes below
- route_
table_ strid - 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
- original
Route StringTable Id - Used internally, see Notes below
- route
Table StringId - The ID of the Route Table to set as the new main route table for the target VPC
- vpc
Id 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.