1. Packages
  2. Alicloud Provider
  3. API Docs
  4. vpc
  5. RouteTable
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

alicloud.vpc.RouteTable

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi

    Provides a VPC Route Table resource. Currently, customized route tables are available in most regions apart from China (Beijing), China (Hangzhou), and China (Shenzhen) regions.

    For information about VPC Route Table and how to use it, see What is Route Table.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const defaultVpc = new alicloud.vpc.Network("defaultVpc", {vpcName: name});
    const _default = new alicloud.vpc.RouteTable("default", {
        description: "test-description",
        vpcId: defaultVpc.id,
        routeTableName: name,
        associateType: "VSwitch",
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default_vpc = alicloud.vpc.Network("defaultVpc", vpc_name=name)
    default = alicloud.vpc.RouteTable("default",
        description="test-description",
        vpc_id=default_vpc.id,
        route_table_name=name,
        associate_type="VSwitch")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultVpc, err := vpc.NewNetwork(ctx, "defaultVpc", &vpc.NetworkArgs{
    			VpcName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vpc.NewRouteTable(ctx, "default", &vpc.RouteTableArgs{
    			Description:    pulumi.String("test-description"),
    			VpcId:          defaultVpc.ID(),
    			RouteTableName: pulumi.String(name),
    			AssociateType:  pulumi.String("VSwitch"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var defaultVpc = new AliCloud.Vpc.Network("defaultVpc", new()
        {
            VpcName = name,
        });
    
        var @default = new AliCloud.Vpc.RouteTable("default", new()
        {
            Description = "test-description",
            VpcId = defaultVpc.Id,
            RouteTableName = name,
            AssociateType = "VSwitch",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.RouteTable;
    import com.pulumi.alicloud.vpc.RouteTableArgs;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var defaultVpc = new Network("defaultVpc", NetworkArgs.builder()
                .vpcName(name)
                .build());
    
            var default_ = new RouteTable("default", RouteTableArgs.builder()
                .description("test-description")
                .vpcId(defaultVpc.id())
                .routeTableName(name)
                .associateType("VSwitch")
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      defaultVpc:
        type: alicloud:vpc:Network
        properties:
          vpcName: ${name}
      default:
        type: alicloud:vpc:RouteTable
        properties:
          description: test-description
          vpcId: ${defaultVpc.id}
          routeTableName: ${name}
          associateType: VSwitch
    

    Create RouteTable Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new RouteTable(name: string, args: RouteTableArgs, opts?: CustomResourceOptions);
    @overload
    def RouteTable(resource_name: str,
                   args: RouteTableArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def RouteTable(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   vpc_id: Optional[str] = None,
                   associate_type: Optional[str] = None,
                   description: Optional[str] = None,
                   name: Optional[str] = None,
                   route_table_name: Optional[str] = None,
                   tags: Optional[Mapping[str, str]] = None)
    func NewRouteTable(ctx *Context, name string, args RouteTableArgs, opts ...ResourceOption) (*RouteTable, error)
    public RouteTable(string name, RouteTableArgs args, CustomResourceOptions? opts = null)
    public RouteTable(String name, RouteTableArgs args)
    public RouteTable(String name, RouteTableArgs args, CustomResourceOptions options)
    
    type: alicloud:vpc:RouteTable
    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 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.
    args RouteTableArgs
    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 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.
    name String
    The unique name of the resource.
    args RouteTableArgs
    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 routeTableResource = new AliCloud.Vpc.RouteTable("routeTableResource", new()
    {
        VpcId = "string",
        AssociateType = "string",
        Description = "string",
        RouteTableName = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := vpc.NewRouteTable(ctx, "routeTableResource", &vpc.RouteTableArgs{
    	VpcId:          pulumi.String("string"),
    	AssociateType:  pulumi.String("string"),
    	Description:    pulumi.String("string"),
    	RouteTableName: pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var routeTableResource = new RouteTable("routeTableResource", RouteTableArgs.builder()
        .vpcId("string")
        .associateType("string")
        .description("string")
        .routeTableName("string")
        .tags(Map.of("string", "string"))
        .build());
    
    route_table_resource = alicloud.vpc.RouteTable("routeTableResource",
        vpc_id="string",
        associate_type="string",
        description="string",
        route_table_name="string",
        tags={
            "string": "string",
        })
    
    const routeTableResource = new alicloud.vpc.RouteTable("routeTableResource", {
        vpcId: "string",
        associateType: "string",
        description: "string",
        routeTableName: "string",
        tags: {
            string: "string",
        },
    });
    
    type: alicloud:vpc:RouteTable
    properties:
        associateType: string
        description: string
        routeTableName: string
        tags:
            string: string
        vpcId: string
    

    RouteTable 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 RouteTable resource accepts the following input properties:

    VpcId string

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    AssociateType string
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    Description string
    Description of the routing table.
    Name string
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    RouteTableName string
    The name of the routing table.
    Tags Dictionary<string, string>
    The tag.
    VpcId string

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    AssociateType string
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    Description string
    Description of the routing table.
    Name string
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    RouteTableName string
    The name of the routing table.
    Tags map[string]string
    The tag.
    vpcId String

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associateType String
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    description String
    Description of the routing table.
    name String
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    routeTableName String
    The name of the routing table.
    tags Map<String,String>
    The tag.
    vpcId string

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associateType string
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    description string
    Description of the routing table.
    name string
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    routeTableName string
    The name of the routing table.
    tags {[key: string]: string}
    The tag.
    vpc_id str

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associate_type str
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    description str
    Description of the routing table.
    name str
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    route_table_name str
    The name of the routing table.
    tags Mapping[str, str]
    The tag.
    vpcId String

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associateType String
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    description String
    Description of the routing table.
    name String
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    routeTableName String
    The name of the routing table.
    tags Map<String>
    The tag.

    Outputs

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

    CreateTime string
    The creation time of the routing table.
    Id string
    The provider-assigned unique ID for this managed resource.
    ResourceGroupId string
    Resource group ID.
    Status string
    Routing table state.
    CreateTime string
    The creation time of the routing table.
    Id string
    The provider-assigned unique ID for this managed resource.
    ResourceGroupId string
    Resource group ID.
    Status string
    Routing table state.
    createTime String
    The creation time of the routing table.
    id String
    The provider-assigned unique ID for this managed resource.
    resourceGroupId String
    Resource group ID.
    status String
    Routing table state.
    createTime string
    The creation time of the routing table.
    id string
    The provider-assigned unique ID for this managed resource.
    resourceGroupId string
    Resource group ID.
    status string
    Routing table state.
    create_time str
    The creation time of the routing table.
    id str
    The provider-assigned unique ID for this managed resource.
    resource_group_id str
    Resource group ID.
    status str
    Routing table state.
    createTime String
    The creation time of the routing table.
    id String
    The provider-assigned unique ID for this managed resource.
    resourceGroupId String
    Resource group ID.
    status String
    Routing table state.

    Look up 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): RouteTable
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            associate_type: Optional[str] = None,
            create_time: Optional[str] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            resource_group_id: Optional[str] = None,
            route_table_name: Optional[str] = None,
            status: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None,
            vpc_id: Optional[str] = None) -> RouteTable
    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)
    public static RouteTable get(String name, Output<String> id, RouteTableState 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:
    AssociateType string
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    CreateTime string
    The creation time of the routing table.
    Description string
    Description of the routing table.
    Name string
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    ResourceGroupId string
    Resource group ID.
    RouteTableName string
    The name of the routing table.
    Status string
    Routing table state.
    Tags Dictionary<string, string>
    The tag.
    VpcId string

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    AssociateType string
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    CreateTime string
    The creation time of the routing table.
    Description string
    Description of the routing table.
    Name string
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    ResourceGroupId string
    Resource group ID.
    RouteTableName string
    The name of the routing table.
    Status string
    Routing table state.
    Tags map[string]string
    The tag.
    VpcId string

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associateType String
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    createTime String
    The creation time of the routing table.
    description String
    Description of the routing table.
    name String
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    resourceGroupId String
    Resource group ID.
    routeTableName String
    The name of the routing table.
    status String
    Routing table state.
    tags Map<String,String>
    The tag.
    vpcId String

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associateType string
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    createTime string
    The creation time of the routing table.
    description string
    Description of the routing table.
    name string
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    resourceGroupId string
    Resource group ID.
    routeTableName string
    The name of the routing table.
    status string
    Routing table state.
    tags {[key: string]: string}
    The tag.
    vpcId string

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associate_type str
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    create_time str
    The creation time of the routing table.
    description str
    Description of the routing table.
    name str
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    resource_group_id str
    Resource group ID.
    route_table_name str
    The name of the routing table.
    status str
    Routing table state.
    tags Mapping[str, str]
    The tag.
    vpc_id str

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    associateType String
    The type of cloud resource that is bound to the routing table. Value:

    • VSwitch: switch.
    • Gateway:IPv4 Gateway.
    createTime String
    The creation time of the routing table.
    description String
    Description of the routing table.
    name String
    Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    Deprecated: Field 'name' has been deprecated from provider version 1.119.1. New field 'route_table_name' instead.

    resourceGroupId String
    Resource group ID.
    routeTableName String
    The name of the routing table.
    status String
    Routing table state.
    tags Map<String>
    The tag.
    vpcId String

    The ID of VPC.

    The following arguments will be discarded. Please use new fields as soon as possible:

    Import

    VPC Route Table can be imported using the id, e.g.

    $ pulumi import alicloud:vpc/routeTable:RouteTable example <id>
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.62.1 published on Monday, Sep 16, 2024 by Pulumi