1. Packages
  2. Azure Classic
  3. API Docs
  4. network
  5. RouteTable

We recommend using Azure Native.

Azure Classic v5.57.0 published on Tuesday, Nov 28, 2023 by Pulumi

azure.network.RouteTable

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.57.0 published on Tuesday, Nov 28, 2023 by Pulumi

    Manages a Route Table

    NOTE on Route Tables and Routes: There is both a standalone route resource, and allows for Routes to be defined in-line within the route_table resource. At this time you cannot use a Route Table with in-line Routes in conjunction with any Route resources. Doing so will cause a conflict of Route configurations and will overwrite Routes.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
        {
            Location = "West Europe",
        });
    
        var exampleRouteTable = new Azure.Network.RouteTable("exampleRouteTable", new()
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            DisableBgpRoutePropagation = false,
            Routes = new[]
            {
                new Azure.Network.Inputs.RouteTableRouteArgs
                {
                    Name = "route1",
                    AddressPrefix = "10.1.0.0/16",
                    NextHopType = "VnetLocal",
                },
            },
            Tags = 
            {
                { "environment", "Production" },
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = network.NewRouteTable(ctx, "exampleRouteTable", &network.RouteTableArgs{
    			Location:                   exampleResourceGroup.Location,
    			ResourceGroupName:          exampleResourceGroup.Name,
    			DisableBgpRoutePropagation: pulumi.Bool(false),
    			Routes: network.RouteTableRouteArray{
    				&network.RouteTableRouteArgs{
    					Name:          pulumi.String("route1"),
    					AddressPrefix: pulumi.String("10.1.0.0/16"),
    					NextHopType:   pulumi.String("VnetLocal"),
    				},
    			},
    			Tags: pulumi.StringMap{
    				"environment": pulumi.String("Production"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.network.RouteTable;
    import com.pulumi.azure.network.RouteTableArgs;
    import com.pulumi.azure.network.inputs.RouteTableRouteArgs;
    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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
                .location("West Europe")
                .build());
    
            var exampleRouteTable = new RouteTable("exampleRouteTable", RouteTableArgs.builder()        
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .disableBgpRoutePropagation(false)
                .routes(RouteTableRouteArgs.builder()
                    .name("route1")
                    .addressPrefix("10.1.0.0/16")
                    .nextHopType("VnetLocal")
                    .build())
                .tags(Map.of("environment", "Production"))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_route_table = azure.network.RouteTable("exampleRouteTable",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        disable_bgp_route_propagation=False,
        routes=[azure.network.RouteTableRouteArgs(
            name="route1",
            address_prefix="10.1.0.0/16",
            next_hop_type="VnetLocal",
        )],
        tags={
            "environment": "Production",
        })
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const exampleRouteTable = new azure.network.RouteTable("exampleRouteTable", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        disableBgpRoutePropagation: false,
        routes: [{
            name: "route1",
            addressPrefix: "10.1.0.0/16",
            nextHopType: "VnetLocal",
        }],
        tags: {
            environment: "Production",
        },
    });
    
    resources:
      exampleResourceGroup:
        type: azure:core:ResourceGroup
        properties:
          location: West Europe
      exampleRouteTable:
        type: azure:network:RouteTable
        properties:
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          disableBgpRoutePropagation: false
          routes:
            - name: route1
              addressPrefix: 10.1.0.0/16
              nextHopType: VnetLocal
          tags:
            environment: Production
    

    Create RouteTable Resource

    new RouteTable(name: string, args: RouteTableArgs, opts?: CustomResourceOptions);
    @overload
    def RouteTable(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   disable_bgp_route_propagation: Optional[bool] = None,
                   location: Optional[str] = None,
                   name: Optional[str] = None,
                   resource_group_name: Optional[str] = None,
                   routes: Optional[Sequence[RouteTableRouteArgs]] = None,
                   tags: Optional[Mapping[str, str]] = None)
    @overload
    def RouteTable(resource_name: str,
                   args: RouteTableArgs,
                   opts: Optional[ResourceOptions] = 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: azure:network:RouteTable
    properties: # The arguments to resource properties.
    options: # 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.
    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.

    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:

    ResourceGroupName string

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    DisableBgpRoutePropagation bool

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    Location string

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    Name string

    The name of the route.

    Routes List<RouteTableRoute>

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    Tags Dictionary<string, string>

    A mapping of tags to assign to the resource.

    ResourceGroupName string

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    DisableBgpRoutePropagation bool

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    Location string

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    Name string

    The name of the route.

    Routes []RouteTableRouteArgs

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    Tags map[string]string

    A mapping of tags to assign to the resource.

    resourceGroupName String

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    disableBgpRoutePropagation Boolean

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location String

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name String

    The name of the route.

    routes List<RouteTableRoute>

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    tags Map<String,String>

    A mapping of tags to assign to the resource.

    resourceGroupName string

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    disableBgpRoutePropagation boolean

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location string

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name string

    The name of the route.

    routes RouteTableRoute[]

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    tags {[key: string]: string}

    A mapping of tags to assign to the resource.

    resource_group_name str

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    disable_bgp_route_propagation bool

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location str

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name str

    The name of the route.

    routes Sequence[RouteTableRouteArgs]

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    tags Mapping[str, str]

    A mapping of tags to assign to the resource.

    resourceGroupName String

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    disableBgpRoutePropagation Boolean

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location String

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name String

    The name of the route.

    routes List<Property Map>

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    tags Map<String>

    A mapping of tags to assign to the resource.

    Outputs

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

    Id string

    The provider-assigned unique ID for this managed resource.

    Subnets List<string>

    The collection of Subnets associated with this route table.

    Id string

    The provider-assigned unique ID for this managed resource.

    Subnets []string

    The collection of Subnets associated with this route table.

    id String

    The provider-assigned unique ID for this managed resource.

    subnets List<String>

    The collection of Subnets associated with this route table.

    id string

    The provider-assigned unique ID for this managed resource.

    subnets string[]

    The collection of Subnets associated with this route table.

    id str

    The provider-assigned unique ID for this managed resource.

    subnets Sequence[str]

    The collection of Subnets associated with this route table.

    id String

    The provider-assigned unique ID for this managed resource.

    subnets List<String>

    The collection of Subnets associated with this route table.

    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,
            disable_bgp_route_propagation: Optional[bool] = None,
            location: Optional[str] = None,
            name: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            routes: Optional[Sequence[RouteTableRouteArgs]] = None,
            subnets: Optional[Sequence[str]] = None,
            tags: Optional[Mapping[str, 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:
    DisableBgpRoutePropagation bool

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    Location string

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    Name string

    The name of the route.

    ResourceGroupName string

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    Routes List<RouteTableRoute>

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    Subnets List<string>

    The collection of Subnets associated with this route table.

    Tags Dictionary<string, string>

    A mapping of tags to assign to the resource.

    DisableBgpRoutePropagation bool

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    Location string

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    Name string

    The name of the route.

    ResourceGroupName string

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    Routes []RouteTableRouteArgs

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    Subnets []string

    The collection of Subnets associated with this route table.

    Tags map[string]string

    A mapping of tags to assign to the resource.

    disableBgpRoutePropagation Boolean

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location String

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name String

    The name of the route.

    resourceGroupName String

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    routes List<RouteTableRoute>

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    subnets List<String>

    The collection of Subnets associated with this route table.

    tags Map<String,String>

    A mapping of tags to assign to the resource.

    disableBgpRoutePropagation boolean

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location string

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name string

    The name of the route.

    resourceGroupName string

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    routes RouteTableRoute[]

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    subnets string[]

    The collection of Subnets associated with this route table.

    tags {[key: string]: string}

    A mapping of tags to assign to the resource.

    disable_bgp_route_propagation bool

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location str

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name str

    The name of the route.

    resource_group_name str

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    routes Sequence[RouteTableRouteArgs]

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    subnets Sequence[str]

    The collection of Subnets associated with this route table.

    tags Mapping[str, str]

    A mapping of tags to assign to the resource.

    disableBgpRoutePropagation Boolean

    Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.

    location String

    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

    name String

    The name of the route.

    resourceGroupName String

    The name of the resource group in which to create the route table. Changing this forces a new resource to be created.

    routes List<Property Map>

    A list of objects representing routes. Each object accepts the arguments documented below.

    NOTE Since route can be configured both inline and via the separate azure.network.Route resource, we have to explicitly set it to empty slice ([]) to remove it.

    subnets List<String>

    The collection of Subnets associated with this route table.

    tags Map<String>

    A mapping of tags to assign to the resource.

    Supporting Types

    RouteTableRoute, RouteTableRouteArgs

    AddressPrefix string

    The destination to which the route applies. Can be CIDR (such as 10.1.0.0/16) or Azure Service Tag (such as ApiManagement, AzureBackup or AzureMonitor) format.

    Name string

    The name of the route.

    NextHopType string

    The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway, VnetLocal, Internet, VirtualAppliance and None.

    NextHopInIpAddress string

    Contains the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.

    AddressPrefix string

    The destination to which the route applies. Can be CIDR (such as 10.1.0.0/16) or Azure Service Tag (such as ApiManagement, AzureBackup or AzureMonitor) format.

    Name string

    The name of the route.

    NextHopType string

    The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway, VnetLocal, Internet, VirtualAppliance and None.

    NextHopInIpAddress string

    Contains the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.

    addressPrefix String

    The destination to which the route applies. Can be CIDR (such as 10.1.0.0/16) or Azure Service Tag (such as ApiManagement, AzureBackup or AzureMonitor) format.

    name String

    The name of the route.

    nextHopType String

    The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway, VnetLocal, Internet, VirtualAppliance and None.

    nextHopInIpAddress String

    Contains the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.

    addressPrefix string

    The destination to which the route applies. Can be CIDR (such as 10.1.0.0/16) or Azure Service Tag (such as ApiManagement, AzureBackup or AzureMonitor) format.

    name string

    The name of the route.

    nextHopType string

    The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway, VnetLocal, Internet, VirtualAppliance and None.

    nextHopInIpAddress string

    Contains the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.

    address_prefix str

    The destination to which the route applies. Can be CIDR (such as 10.1.0.0/16) or Azure Service Tag (such as ApiManagement, AzureBackup or AzureMonitor) format.

    name str

    The name of the route.

    next_hop_type str

    The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway, VnetLocal, Internet, VirtualAppliance and None.

    next_hop_in_ip_address str

    Contains the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.

    addressPrefix String

    The destination to which the route applies. Can be CIDR (such as 10.1.0.0/16) or Azure Service Tag (such as ApiManagement, AzureBackup or AzureMonitor) format.

    name String

    The name of the route.

    nextHopType String

    The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway, VnetLocal, Internet, VirtualAppliance and None.

    nextHopInIpAddress String

    Contains the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.

    Import

    Route Tables can be imported using the resource id, e.g.

     $ pulumi import azure:network/routeTable:RouteTable example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/routeTables/mytable1
    

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the azurerm Terraform Provider.

    azure logo

    We recommend using Azure Native.

    Azure Classic v5.57.0 published on Tuesday, Nov 28, 2023 by Pulumi