2016-01-10 16:02:48 +01:00
---
layout: "azurerm"
page_title: "Azure Resource Manager: azurerm_route"
sidebar_current: "docs-azurerm-resource-network-route"
description: |-
Creates a new Route Resource
---
# azurerm\_route
Creates a new Route Resource
## Example Usage
2017-04-17 12:17:54 +02:00
```hcl
2016-01-10 16:02:48 +01:00
resource "azurerm_resource_group" "test" {
2017-02-18 23:48:50 +01:00
name = "acceptanceTestResourceGroup1"
location = "West US"
2016-01-10 16:02:48 +01:00
}
resource "azurerm_route_table" "test" {
2017-02-18 23:48:50 +01:00
name = "acceptanceTestRouteTable1"
location = "West US"
resource_group_name = "${azurerm_resource_group.test.name}"
2016-01-10 16:02:48 +01:00
}
resource "azurerm_route" "test" {
2017-02-18 23:48:50 +01:00
name = "acceptanceTestRoute1"
resource_group_name = "${azurerm_resource_group.test.name}"
route_table_name = "${azurerm_route_table.test.name}"
2016-01-10 16:02:48 +01:00
2017-02-18 23:48:50 +01:00
address_prefix = "10.1.0.0/16"
next_hop_type = "vnetlocal"
2016-01-10 16:02:48 +01:00
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) The name of the route. Changing this forces a
new resource to be created.
* `resource_group_name` - (Required) The name of the resource group in which to
create the route.
2017-02-18 23:48:50 +01:00
2016-01-10 16:02:48 +01:00
* `route_table_name` - (Required) The name of the route table to which to create the route
2017-02-18 23:48:50 +01:00
2016-01-10 16:02:48 +01:00
* `address_prefix` - (Required) The destination CIDR to which the route applies, such as 10.1.0.0/16
* `next_hop_type` - (Required) 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` - (Optional) Contains the IP address packets should be forwarded to. Next hop values are only allowed in routes where the next hop type is VirtualAppliance.
## Attributes Reference
The following attributes are exported:
* `id` - The Route ID.
2016-11-28 18:35:55 +01:00
## Import
2017-02-18 23:48:50 +01:00
Routes can be imported using the `resource id` , e.g.
2016-11-28 18:35:55 +01:00
```
terraform import azurerm_route.testRoute /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/routeTables/mytable1/routes/myroute1
```