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

We recommend using Azure Native.

Azure Classic v5.58.0 published on Saturday, Dec 2, 2023 by Pulumi

azure.network.Route

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.58.0 published on Saturday, Dec 2, 2023 by Pulumi

    Manages a Route within a Route Table.

    NOTE on Route Tables and Routes: This provider currently provides 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,
        });
    
        var exampleRoute = new Azure.Network.Route("exampleRoute", new()
        {
            ResourceGroupName = exampleResourceGroup.Name,
            RouteTableName = exampleRouteTable.Name,
            AddressPrefix = "10.1.0.0/16",
            NextHopType = "VnetLocal",
        });
    
    });
    
    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
    		}
    		exampleRouteTable, err := network.NewRouteTable(ctx, "exampleRouteTable", &network.RouteTableArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = network.NewRoute(ctx, "exampleRoute", &network.RouteArgs{
    			ResourceGroupName: exampleResourceGroup.Name,
    			RouteTableName:    exampleRouteTable.Name,
    			AddressPrefix:     pulumi.String("10.1.0.0/16"),
    			NextHopType:       pulumi.String("VnetLocal"),
    		})
    		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.Route;
    import com.pulumi.azure.network.RouteArgs;
    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())
                .build());
    
            var exampleRoute = new Route("exampleRoute", RouteArgs.builder()        
                .resourceGroupName(exampleResourceGroup.name())
                .routeTableName(exampleRouteTable.name())
                .addressPrefix("10.1.0.0/16")
                .nextHopType("VnetLocal")
                .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)
    example_route = azure.network.Route("exampleRoute",
        resource_group_name=example_resource_group.name,
        route_table_name=example_route_table.name,
        address_prefix="10.1.0.0/16",
        next_hop_type="VnetLocal")
    
    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,
    });
    const exampleRoute = new azure.network.Route("exampleRoute", {
        resourceGroupName: exampleResourceGroup.name,
        routeTableName: exampleRouteTable.name,
        addressPrefix: "10.1.0.0/16",
        nextHopType: "VnetLocal",
    });
    
    resources:
      exampleResourceGroup:
        type: azure:core:ResourceGroup
        properties:
          location: West Europe
      exampleRouteTable:
        type: azure:network:RouteTable
        properties:
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
      exampleRoute:
        type: azure:network:Route
        properties:
          resourceGroupName: ${exampleResourceGroup.name}
          routeTableName: ${exampleRouteTable.name}
          addressPrefix: 10.1.0.0/16
          nextHopType: VnetLocal
    

    Create Route Resource

    new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);
    @overload
    def Route(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              address_prefix: Optional[str] = None,
              name: Optional[str] = None,
              next_hop_in_ip_address: Optional[str] = None,
              next_hop_type: Optional[str] = None,
              resource_group_name: Optional[str] = None,
              route_table_name: Optional[str] = None)
    @overload
    def Route(resource_name: str,
              args: RouteArgs,
              opts: Optional[ResourceOptions] = None)
    func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)
    public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)
    public Route(String name, RouteArgs args)
    public Route(String name, RouteArgs args, CustomResourceOptions options)
    
    type: azure:network:Route
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args RouteArgs
    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 RouteArgs
    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 RouteArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args RouteArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    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.

    NextHopType string

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

    ResourceGroupName string

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

    RouteTableName string

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

    Name string

    The name of the route. Changing this forces a new resource to be created.

    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.

    NextHopType string

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

    ResourceGroupName string

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

    RouteTableName string

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

    Name string

    The name of the route. Changing this forces a new resource to be created.

    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.

    nextHopType String

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

    resourceGroupName String

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

    routeTableName String

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

    name String

    The name of the route. Changing this forces a new resource to be created.

    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.

    nextHopType string

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

    resourceGroupName string

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

    routeTableName string

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

    name string

    The name of the route. Changing this forces a new resource to be created.

    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.

    next_hop_type str

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

    resource_group_name str

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

    route_table_name str

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

    name str

    The name of the route. Changing this forces a new resource to be created.

    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.

    nextHopType String

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

    resourceGroupName String

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

    routeTableName String

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

    name String

    The name of the route. Changing this forces a new resource to be created.

    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.

    Outputs

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

    Id string

    The provider-assigned unique ID for this managed resource.

    Id string

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    id string

    The provider-assigned unique ID for this managed resource.

    id str

    The provider-assigned unique ID for this managed resource.

    id String

    The provider-assigned unique ID for this managed resource.

    Look up Existing Route Resource

    Get an existing Route 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?: RouteState, opts?: CustomResourceOptions): Route
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            address_prefix: Optional[str] = None,
            name: Optional[str] = None,
            next_hop_in_ip_address: Optional[str] = None,
            next_hop_type: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            route_table_name: Optional[str] = None) -> Route
    func GetRoute(ctx *Context, name string, id IDInput, state *RouteState, opts ...ResourceOption) (*Route, error)
    public static Route Get(string name, Input<string> id, RouteState? state, CustomResourceOptions? opts = null)
    public static Route get(String name, Output<String> id, RouteState 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:
    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. Changing this forces a new resource to be created.

    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.

    NextHopType string

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

    ResourceGroupName string

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

    RouteTableName string

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

    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. Changing this forces a new resource to be created.

    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.

    NextHopType string

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

    ResourceGroupName string

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

    RouteTableName string

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

    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. Changing this forces a new resource to be created.

    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.

    nextHopType String

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

    resourceGroupName String

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

    routeTableName String

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

    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. Changing this forces a new resource to be created.

    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.

    nextHopType string

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

    resourceGroupName string

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

    routeTableName string

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

    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. Changing this forces a new resource to be created.

    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.

    next_hop_type str

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

    resource_group_name str

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

    route_table_name str

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

    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. Changing this forces a new resource to be created.

    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.

    nextHopType String

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

    resourceGroupName String

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

    routeTableName String

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

    Import

    Routes can be imported using the resource id, e.g.

     $ pulumi import azure:network/route:Route exampleRoute /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/routeTables/mytable1/routes/myroute1
    

    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.58.0 published on Saturday, Dec 2, 2023 by Pulumi