We recommend using Azure Native.
azure.network.RouteTable
Explore with Pulumi AI
Manages a Route Table
NOTE on Route Tables and Routes: There is both a standalone
routeresource, and allows for Routes to be defined in-line within theroute_tableresource. 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
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
    name: "example-resources",
    location: "West Europe",
});
const exampleRouteTable = new azure.network.RouteTable("example", {
    name: "example-route-table",
    location: example.location,
    resourceGroupName: example.name,
    routes: [{
        name: "route1",
        addressPrefix: "10.1.0.0/16",
        nextHopType: "VnetLocal",
    }],
    tags: {
        environment: "Production",
    },
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
    name="example-resources",
    location="West Europe")
example_route_table = azure.network.RouteTable("example",
    name="example-route-table",
    location=example.location,
    resource_group_name=example.name,
    routes=[{
        "name": "route1",
        "address_prefix": "10.1.0.0/16",
        "next_hop_type": "VnetLocal",
    }],
    tags={
        "environment": "Production",
    })
package main
import (
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
			Name:     pulumi.String("example-resources"),
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		_, err = network.NewRouteTable(ctx, "example", &network.RouteTableArgs{
			Name:              pulumi.String("example-route-table"),
			Location:          example.Location,
			ResourceGroupName: example.Name,
			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
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() => 
{
    var example = new Azure.Core.ResourceGroup("example", new()
    {
        Name = "example-resources",
        Location = "West Europe",
    });
    var exampleRouteTable = new Azure.Network.RouteTable("example", new()
    {
        Name = "example-route-table",
        Location = example.Location,
        ResourceGroupName = example.Name,
        Routes = new[]
        {
            new Azure.Network.Inputs.RouteTableRouteArgs
            {
                Name = "route1",
                AddressPrefix = "10.1.0.0/16",
                NextHopType = "VnetLocal",
            },
        },
        Tags = 
        {
            { "environment", "Production" },
        },
    });
});
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
            .name("example-resources")
            .location("West Europe")
            .build());
        var exampleRouteTable = new RouteTable("exampleRouteTable", RouteTableArgs.builder()
            .name("example-route-table")
            .location(example.location())
            .resourceGroupName(example.name())
            .routes(RouteTableRouteArgs.builder()
                .name("route1")
                .addressPrefix("10.1.0.0/16")
                .nextHopType("VnetLocal")
                .build())
            .tags(Map.of("environment", "Production"))
            .build());
    }
}
resources:
  example:
    type: azure:core:ResourceGroup
    properties:
      name: example-resources
      location: West Europe
  exampleRouteTable:
    type: azure:network:RouteTable
    name: example
    properties:
      name: example-route-table
      location: ${example.location}
      resourceGroupName: ${example.name}
      routes:
        - name: route1
          addressPrefix: 10.1.0.0/16
          nextHopType: VnetLocal
      tags:
        environment: Production
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,
               resource_group_name: Optional[str] = None,
               bgp_route_propagation_enabled: Optional[bool] = None,
               location: Optional[str] = None,
               name: Optional[str] = None,
               routes: Optional[Sequence[RouteTableRouteArgs]] = 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: azure:network: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 Azure.Network.RouteTable("routeTableResource", new()
{
    ResourceGroupName = "string",
    BgpRoutePropagationEnabled = false,
    Location = "string",
    Name = "string",
    Routes = new[]
    {
        new Azure.Network.Inputs.RouteTableRouteArgs
        {
            AddressPrefix = "string",
            Name = "string",
            NextHopType = "string",
            NextHopInIpAddress = "string",
        },
    },
    Tags = 
    {
        { "string", "string" },
    },
});
example, err := network.NewRouteTable(ctx, "routeTableResource", &network.RouteTableArgs{
	ResourceGroupName:          pulumi.String("string"),
	BgpRoutePropagationEnabled: pulumi.Bool(false),
	Location:                   pulumi.String("string"),
	Name:                       pulumi.String("string"),
	Routes: network.RouteTableRouteArray{
		&network.RouteTableRouteArgs{
			AddressPrefix:      pulumi.String("string"),
			Name:               pulumi.String("string"),
			NextHopType:        pulumi.String("string"),
			NextHopInIpAddress: pulumi.String("string"),
		},
	},
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
var routeTableResource = new RouteTable("routeTableResource", RouteTableArgs.builder()
    .resourceGroupName("string")
    .bgpRoutePropagationEnabled(false)
    .location("string")
    .name("string")
    .routes(RouteTableRouteArgs.builder()
        .addressPrefix("string")
        .name("string")
        .nextHopType("string")
        .nextHopInIpAddress("string")
        .build())
    .tags(Map.of("string", "string"))
    .build());
route_table_resource = azure.network.RouteTable("routeTableResource",
    resource_group_name="string",
    bgp_route_propagation_enabled=False,
    location="string",
    name="string",
    routes=[{
        "address_prefix": "string",
        "name": "string",
        "next_hop_type": "string",
        "next_hop_in_ip_address": "string",
    }],
    tags={
        "string": "string",
    })
const routeTableResource = new azure.network.RouteTable("routeTableResource", {
    resourceGroupName: "string",
    bgpRoutePropagationEnabled: false,
    location: "string",
    name: "string",
    routes: [{
        addressPrefix: "string",
        name: "string",
        nextHopType: "string",
        nextHopInIpAddress: "string",
    }],
    tags: {
        string: "string",
    },
});
type: azure:network:RouteTable
properties:
    bgpRoutePropagationEnabled: false
    location: string
    name: string
    resourceGroupName: string
    routes:
        - addressPrefix: string
          name: string
          nextHopInIpAddress: string
          nextHopType: string
    tags:
        string: 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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RouteTable resource accepts the following input properties:
- ResourceGroup stringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- BgpRoute boolPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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<RouteTable Route> 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- ResourceGroup stringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- BgpRoute boolPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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
[]RouteTable Route Args 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- map[string]string
- A mapping of tags to assign to the resource.
- resourceGroup StringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- bgpRoute BooleanPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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<RouteTable Route> 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- Map<String,String>
- A mapping of tags to assign to the resource.
- resourceGroup stringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- bgpRoute booleanPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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
RouteTable Route[] 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- resource_group_ strname 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- bgp_route_ boolpropagation_ enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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[RouteTable Route Args] 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- resourceGroup StringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- bgpRoute BooleanPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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 - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- 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:
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,
        bgp_route_propagation_enabled: 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) -> RouteTablefunc 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)resources:  _:    type: azure:network:RouteTable    get:      id: ${id}- 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.
- BgpRoute boolPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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.
- ResourceGroup stringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- Routes
List<RouteTable Route> 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- Subnets List<string>
- The collection of Subnets associated with this route table.
- Dictionary<string, string>
- A mapping of tags to assign to the resource.
- BgpRoute boolPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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.
- ResourceGroup stringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- Routes
[]RouteTable Route Args 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- Subnets []string
- The collection of Subnets associated with this route table.
- map[string]string
- A mapping of tags to assign to the resource.
- bgpRoute BooleanPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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.
- resourceGroup StringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- routes
List<RouteTable Route> 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- subnets List<String>
- The collection of Subnets associated with this route table.
- Map<String,String>
- A mapping of tags to assign to the resource.
- bgpRoute booleanPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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.
- resourceGroup stringName 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- routes
RouteTable Route[] 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- subnets string[]
- The collection of Subnets associated with this route table.
- {[key: string]: string}
- A mapping of tags to assign to the resource.
- bgp_route_ boolpropagation_ enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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_ strname 
- The name of the resource group in which to create the route table. Changing this forces a new resource to be created.
- routes
Sequence[RouteTable Route Args] 
- A list of objects representing routes. Each object accepts the arguments documented below. - NOTE Since - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- subnets Sequence[str]
- The collection of Subnets associated with this route table.
- Mapping[str, str]
- A mapping of tags to assign to the resource.
- bgpRoute BooleanPropagation Enabled 
- Boolean flag which controls propagation of routes learned by BGP on that route table. Defaults to true.
- 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.
- resourceGroup StringName 
- 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 - routecan be configured both inline and via the separate- azure.network.Routeresource, we have to explicitly set it to empty slice (- []) to remove it.
- subnets List<String>
- The collection of Subnets associated with this route table.
- 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 asApiManagement,AzureBackuporAzureMonitor) format.
- Name string
- The name of the route.
- NextHop stringType 
- The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway,VnetLocal,Internet,VirtualApplianceandNone.
- NextHop stringIn Ip Address 
- 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 asApiManagement,AzureBackuporAzureMonitor) format.
- Name string
- The name of the route.
- NextHop stringType 
- The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway,VnetLocal,Internet,VirtualApplianceandNone.
- NextHop stringIn Ip Address 
- 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 asApiManagement,AzureBackuporAzureMonitor) format.
- name String
- The name of the route.
- nextHop StringType 
- The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway,VnetLocal,Internet,VirtualApplianceandNone.
- nextHop StringIn Ip Address 
- 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 asApiManagement,AzureBackuporAzureMonitor) format.
- name string
- The name of the route.
- nextHop stringType 
- The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway,VnetLocal,Internet,VirtualApplianceandNone.
- nextHop stringIn Ip Address 
- 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 asApiManagement,AzureBackuporAzureMonitor) format.
- name str
- The name of the route.
- next_hop_ strtype 
- The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway,VnetLocal,Internet,VirtualApplianceandNone.
- next_hop_ strin_ ip_ address 
- 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 asApiManagement,AzureBackuporAzureMonitor) format.
- name String
- The name of the route.
- nextHop StringType 
- The type of Azure hop the packet should be sent to. Possible values are VirtualNetworkGateway,VnetLocal,Internet,VirtualApplianceandNone.
- nextHop StringIn Ip Address 
- 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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the azurermTerraform Provider.