1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. ens
  6. getNetworkRouteTables
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.108.0
published on Thursday, Sep 17, 2026 by Pulumi

    This data source provides the ENS Network Route Tables of the current Alibaba Cloud user.

    NOTE: Available since v1.291.0.

    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 ensRegionId = config.get("ensRegionId") || "cn-hangzhou-31";
    const defaultNetwork = new alicloud.ens.Network("default", {
        networkName: name,
        description: name,
        cidrBlock: "10.0.0.0/8",
        ensRegionId: ensRegionId,
    });
    const defaultNetworkRouteTable = new alicloud.ens.NetworkRouteTable("default", {
        networkId: defaultNetwork.id,
        associateType: "Gateway",
        routeTableName: name,
        description: name,
    });
    const _default = alicloud.ens.getNetworkRouteTablesOutput({
        routeTableId: defaultNetworkRouteTable.routeTableId,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    ens_region_id = config.get("ensRegionId")
    if ens_region_id is None:
        ens_region_id = "cn-hangzhou-31"
    default_network = alicloud.ens.Network("default",
        network_name=name,
        description=name,
        cidr_block="10.0.0.0/8",
        ens_region_id=ens_region_id)
    default_network_route_table = alicloud.ens.NetworkRouteTable("default",
        network_id=default_network.id,
        associate_type="Gateway",
        route_table_name=name,
        description=name)
    default = alicloud.ens.get_network_route_tables_output(route_table_id=default_network_route_table.route_table_id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ens"
    	"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
    		}
    		ensRegionId := "cn-hangzhou-31"
    		if param := cfg.Get("ensRegionId"); param != "" {
    			ensRegionId = param
    		}
    		defaultNetwork, err := ens.NewNetwork(ctx, "default", &ens.NetworkArgs{
    			NetworkName: pulumi.String(name),
    			Description: pulumi.String(name),
    			CidrBlock:   pulumi.String("10.0.0.0/8"),
    			EnsRegionId: pulumi.String(ensRegionId),
    		})
    		if err != nil {
    			return err
    		}
    		defaultNetworkRouteTable, err := ens.NewNetworkRouteTable(ctx, "default", &ens.NetworkRouteTableArgs{
    			NetworkId:      defaultNetwork.ID().ToIDOutput().ToStringOutput(),
    			AssociateType:  pulumi.String("Gateway"),
    			RouteTableName: pulumi.String(name),
    			Description:    pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		_ = ens.GetNetworkRouteTablesOutput(ctx, ens.GetNetworkRouteTablesOutputArgs{
    			RouteTableId: defaultNetworkRouteTable.RouteTableId,
    		}, nil)
    		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 ensRegionId = config.Get("ensRegionId") ?? "cn-hangzhou-31";
        var defaultNetwork = new AliCloud.Ens.Network("default", new()
        {
            NetworkName = name,
            Description = name,
            CidrBlock = "10.0.0.0/8",
            EnsRegionId = ensRegionId,
        });
    
        var defaultNetworkRouteTable = new AliCloud.Ens.NetworkRouteTable("default", new()
        {
            NetworkId = defaultNetwork.Id,
            AssociateType = "Gateway",
            RouteTableName = name,
            Description = name,
        });
    
        var @default = AliCloud.Ens.GetNetworkRouteTables.Invoke(new()
        {
            RouteTableId = defaultNetworkRouteTable.RouteTableId,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.ens.Network;
    import com.pulumi.alicloud.ens.NetworkArgs;
    import com.pulumi.alicloud.ens.NetworkRouteTable;
    import com.pulumi.alicloud.ens.NetworkRouteTableArgs;
    import com.pulumi.alicloud.ens.EnsFunctions;
    import com.pulumi.alicloud.ens.inputs.GetNetworkRouteTablesArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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");
            final var ensRegionId = config.get("ensRegionId").orElse("cn-hangzhou-31");
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .networkName(name)
                .description(name)
                .cidrBlock("10.0.0.0/8")
                .ensRegionId(ensRegionId)
                .build());
    
            var defaultNetworkRouteTable = new NetworkRouteTable("defaultNetworkRouteTable", NetworkRouteTableArgs.builder()
                .networkId(defaultNetwork.id())
                .associateType("Gateway")
                .routeTableName(name)
                .description(name)
                .build());
    
            final var default = EnsFunctions.getNetworkRouteTables(GetNetworkRouteTablesArgs.builder()
                .routeTableId(defaultNetworkRouteTable.routeTableId())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
      ensRegionId:
        type: string
        default: cn-hangzhou-31
    resources:
      defaultNetwork:
        type: alicloud:ens:Network
        name: default
        properties:
          networkName: ${name}
          description: ${name}
          cidrBlock: 10.0.0.0/8
          ensRegionId: ${ensRegionId}
      defaultNetworkRouteTable:
        type: alicloud:ens:NetworkRouteTable
        name: default
        properties:
          networkId: ${defaultNetwork.id}
          associateType: Gateway
          routeTableName: ${name}
          description: ${name}
    variables:
      default:
        fn::invoke:
          function: alicloud:ens:getNetworkRouteTables
          arguments:
            routeTableId: ${defaultNetworkRouteTable.routeTableId}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_ens_getnetworkroutetables" "default" {
      route_table_id = alicloud_ens_networkroutetable.default.route_table_id
    }
    
    resource "alicloud_ens_network" "default" {
      network_name  = var.name
      description   = var.name
      cidr_block    = "10.0.0.0/8"
      ens_region_id = var.ensRegionId
    }
    resource "alicloud_ens_networkroutetable" "default" {
      network_id       = alicloud_ens_network.default.id
      associate_type   = "Gateway"
      route_table_name = var.name
      description      = var.name
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    variable "ensRegionId" {
      type    = string
      default = "cn-hangzhou-31"
    }
    

    Using getNetworkRouteTables

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getNetworkRouteTables(args: GetNetworkRouteTablesArgs, opts?: InvokeOptions): Promise<GetNetworkRouteTablesResult>
    function getNetworkRouteTablesOutput(args: GetNetworkRouteTablesOutputArgs, opts?: InvokeOutputOptions): Output<GetNetworkRouteTablesResult>
    def get_network_route_tables(associate_type: Optional[str] = None,
                                 network_id: Optional[str] = None,
                                 output_file: Optional[str] = None,
                                 route_table_id: Optional[str] = None,
                                 route_table_name: Optional[str] = None,
                                 route_table_type: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetNetworkRouteTablesResult
    def get_network_route_tables_output(associate_type: pulumi.Input[Optional[str]] = None,
                                 network_id: pulumi.Input[Optional[str]] = None,
                                 output_file: pulumi.Input[Optional[str]] = None,
                                 route_table_id: pulumi.Input[Optional[str]] = None,
                                 route_table_name: pulumi.Input[Optional[str]] = None,
                                 route_table_type: pulumi.Input[Optional[str]] = None,
                                 opts: Optional[InvokeOutputOptions] = None) -> Output[GetNetworkRouteTablesResult]
    func GetNetworkRouteTables(ctx *Context, args *GetNetworkRouteTablesArgs, opts ...InvokeOption) (*GetNetworkRouteTablesResult, error)
    func GetNetworkRouteTablesOutput(ctx *Context, args *GetNetworkRouteTablesOutputArgs, opts ...InvokeOption) GetNetworkRouteTablesResultOutput

    > Note: This function is named GetNetworkRouteTables in the Go SDK.

    public static class GetNetworkRouteTables 
    {
        public static Task<GetNetworkRouteTablesResult> InvokeAsync(GetNetworkRouteTablesArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkRouteTablesResult> Invoke(GetNetworkRouteTablesInvokeArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkRouteTablesResult> Invoke(GetNetworkRouteTablesInvokeArgs args, InvokeOutputOptions opts)
    }
    public static CompletableFuture<GetNetworkRouteTablesResult> getNetworkRouteTables(GetNetworkRouteTablesArgs args, InvokeOptions options)
    public static Output<GetNetworkRouteTablesResult> getNetworkRouteTables(GetNetworkRouteTablesArgs args, InvokeOptions options)
    public static Output<GetNetworkRouteTablesResult> getNetworkRouteTables(GetNetworkRouteTablesArgs args, InvokeOutputOptions options)
    
    fn::invoke:
      function: alicloud:ens/getNetworkRouteTables:getNetworkRouteTables
      arguments:
        # arguments dictionary
    data "alicloud_ens_get_network_route_tables" "name" {
        # arguments
    }

    The following arguments are supported:

    AssociateType string
    The binding type of the routing table. Value: VSwitch, Gateway.
    NetworkId string
    The network ID.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RouteTableId string
    The ID of the routing table.
    RouteTableName string
    The name of the routing table.
    RouteTableType string
    The type of the routing table. Value: Custom, System.
    AssociateType string
    The binding type of the routing table. Value: VSwitch, Gateway.
    NetworkId string
    The network ID.
    OutputFile string
    File name where to save data source results (after running pulumi preview).
    RouteTableId string
    The ID of the routing table.
    RouteTableName string
    The name of the routing table.
    RouteTableType string
    The type of the routing table. Value: Custom, System.
    associate_type string
    The binding type of the routing table. Value: VSwitch, Gateway.
    network_id string
    The network ID.
    output_file string
    File name where to save data source results (after running pulumi preview).
    route_table_id string
    The ID of the routing table.
    route_table_name string
    The name of the routing table.
    route_table_type string
    The type of the routing table. Value: Custom, System.
    associateType String
    The binding type of the routing table. Value: VSwitch, Gateway.
    networkId String
    The network ID.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    routeTableId String
    The ID of the routing table.
    routeTableName String
    The name of the routing table.
    routeTableType String
    The type of the routing table. Value: Custom, System.
    associateType string
    The binding type of the routing table. Value: VSwitch, Gateway.
    networkId string
    The network ID.
    outputFile string
    File name where to save data source results (after running pulumi preview).
    routeTableId string
    The ID of the routing table.
    routeTableName string
    The name of the routing table.
    routeTableType string
    The type of the routing table. Value: Custom, System.
    associate_type str
    The binding type of the routing table. Value: VSwitch, Gateway.
    network_id str
    The network ID.
    output_file str
    File name where to save data source results (after running pulumi preview).
    route_table_id str
    The ID of the routing table.
    route_table_name str
    The name of the routing table.
    route_table_type str
    The type of the routing table. Value: Custom, System.
    associateType String
    The binding type of the routing table. Value: VSwitch, Gateway.
    networkId String
    The network ID.
    outputFile String
    File name where to save data source results (after running pulumi preview).
    routeTableId String
    The ID of the routing table.
    routeTableName String
    The name of the routing table.
    routeTableType String
    The type of the routing table. Value: Custom, System.

    getNetworkRouteTables Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Ids List<string>
    A list of routing table IDs.
    Names List<string>
    A list of routing table names.
    Tables List<Pulumi.AliCloud.Ens.Outputs.GetNetworkRouteTablesTable>
    A list of routing tables. Each element contains the following attributes:
    AssociateType string
    The binding type of the routing table.
    NetworkId string
    The network ID.
    OutputFile string
    RouteTableId string
    The ID of the routing table.
    RouteTableName string
    The name of the routing table.
    RouteTableType string
    The type of the routing table.
    Id string
    The provider-assigned unique ID for this managed resource.
    Ids []string
    A list of routing table IDs.
    Names []string
    A list of routing table names.
    Tables []GetNetworkRouteTablesTable
    A list of routing tables. Each element contains the following attributes:
    AssociateType string
    The binding type of the routing table.
    NetworkId string
    The network ID.
    OutputFile string
    RouteTableId string
    The ID of the routing table.
    RouteTableName string
    The name of the routing table.
    RouteTableType string
    The type of the routing table.
    id string
    The provider-assigned unique ID for this managed resource.
    ids list(string)
    A list of routing table IDs.
    names list(string)
    A list of routing table names.
    tables list(object)
    A list of routing tables. Each element contains the following attributes:
    associate_type string
    The binding type of the routing table.
    network_id string
    The network ID.
    output_file string
    route_table_id string
    The ID of the routing table.
    route_table_name string
    The name of the routing table.
    route_table_type string
    The type of the routing table.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of routing table IDs.
    names List<String>
    A list of routing table names.
    tables List<GetNetworkRouteTablesTable>
    A list of routing tables. Each element contains the following attributes:
    associateType String
    The binding type of the routing table.
    networkId String
    The network ID.
    outputFile String
    routeTableId String
    The ID of the routing table.
    routeTableName String
    The name of the routing table.
    routeTableType String
    The type of the routing table.
    id string
    The provider-assigned unique ID for this managed resource.
    ids string[]
    A list of routing table IDs.
    names string[]
    A list of routing table names.
    tables GetNetworkRouteTablesTable[]
    A list of routing tables. Each element contains the following attributes:
    associateType string
    The binding type of the routing table.
    networkId string
    The network ID.
    outputFile string
    routeTableId string
    The ID of the routing table.
    routeTableName string
    The name of the routing table.
    routeTableType string
    The type of the routing table.
    id str
    The provider-assigned unique ID for this managed resource.
    ids Sequence[str]
    A list of routing table IDs.
    names Sequence[str]
    A list of routing table names.
    tables Sequence[GetNetworkRouteTablesTable]
    A list of routing tables. Each element contains the following attributes:
    associate_type str
    The binding type of the routing table.
    network_id str
    The network ID.
    output_file str
    route_table_id str
    The ID of the routing table.
    route_table_name str
    The name of the routing table.
    route_table_type str
    The type of the routing table.
    id String
    The provider-assigned unique ID for this managed resource.
    ids List<String>
    A list of routing table IDs.
    names List<String>
    A list of routing table names.
    tables List<Property Map>
    A list of routing tables. Each element contains the following attributes:
    associateType String
    The binding type of the routing table.
    networkId String
    The network ID.
    outputFile String
    routeTableId String
    The ID of the routing table.
    routeTableName String
    The name of the routing table.
    routeTableType String
    The type of the routing table.

    Supporting Types

    GetNetworkRouteTablesTable

    AssociateType string
    The binding type of the routing table. Value: VSwitch, Gateway.
    CreateTime string
    The creation time of the routing table.
    Description string
    The description of the routing table.
    Id string
    The ID of the routing table. Same as routeTableId.
    IsDefaultGatewayRouteTable bool
    Whether it is the default gateway route table.
    NetworkId string
    The network ID.
    RouteTableId string
    The ID of the routing table.
    RouteTableName string
    The name of the routing table.
    RouteTableType string
    The type of the routing table. Value: Custom, System.
    Status string
    The status of the routing table.
    AssociateType string
    The binding type of the routing table. Value: VSwitch, Gateway.
    CreateTime string
    The creation time of the routing table.
    Description string
    The description of the routing table.
    Id string
    The ID of the routing table. Same as routeTableId.
    IsDefaultGatewayRouteTable bool
    Whether it is the default gateway route table.
    NetworkId string
    The network ID.
    RouteTableId string
    The ID of the routing table.
    RouteTableName string
    The name of the routing table.
    RouteTableType string
    The type of the routing table. Value: Custom, System.
    Status string
    The status of the routing table.
    associate_type string
    The binding type of the routing table. Value: VSwitch, Gateway.
    create_time string
    The creation time of the routing table.
    description string
    The description of the routing table.
    id string
    The ID of the routing table. Same as routeTableId.
    is_default_gateway_route_table bool
    Whether it is the default gateway route table.
    network_id string
    The network ID.
    route_table_id string
    The ID of the routing table.
    route_table_name string
    The name of the routing table.
    route_table_type string
    The type of the routing table. Value: Custom, System.
    status string
    The status of the routing table.
    associateType String
    The binding type of the routing table. Value: VSwitch, Gateway.
    createTime String
    The creation time of the routing table.
    description String
    The description of the routing table.
    id String
    The ID of the routing table. Same as routeTableId.
    isDefaultGatewayRouteTable Boolean
    Whether it is the default gateway route table.
    networkId String
    The network ID.
    routeTableId String
    The ID of the routing table.
    routeTableName String
    The name of the routing table.
    routeTableType String
    The type of the routing table. Value: Custom, System.
    status String
    The status of the routing table.
    associateType string
    The binding type of the routing table. Value: VSwitch, Gateway.
    createTime string
    The creation time of the routing table.
    description string
    The description of the routing table.
    id string
    The ID of the routing table. Same as routeTableId.
    isDefaultGatewayRouteTable boolean
    Whether it is the default gateway route table.
    networkId string
    The network ID.
    routeTableId string
    The ID of the routing table.
    routeTableName string
    The name of the routing table.
    routeTableType string
    The type of the routing table. Value: Custom, System.
    status string
    The status of the routing table.
    associate_type str
    The binding type of the routing table. Value: VSwitch, Gateway.
    create_time str
    The creation time of the routing table.
    description str
    The description of the routing table.
    id str
    The ID of the routing table. Same as routeTableId.
    is_default_gateway_route_table bool
    Whether it is the default gateway route table.
    network_id str
    The network ID.
    route_table_id str
    The ID of the routing table.
    route_table_name str
    The name of the routing table.
    route_table_type str
    The type of the routing table. Value: Custom, System.
    status str
    The status of the routing table.
    associateType String
    The binding type of the routing table. Value: VSwitch, Gateway.
    createTime String
    The creation time of the routing table.
    description String
    The description of the routing table.
    id String
    The ID of the routing table. Same as routeTableId.
    isDefaultGatewayRouteTable Boolean
    Whether it is the default gateway route table.
    networkId String
    The network ID.
    routeTableId String
    The ID of the routing table.
    routeTableName String
    The name of the routing table.
    routeTableType String
    The type of the routing table. Value: Custom, System.
    status String
    The status of the routing table.

    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 alicloud logo
    Viewing docs for Alibaba Cloud v3.108.0
    published on Thursday, Sep 17, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial