Manages a Route Table
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_route_table" "example" {
name = "example-route-table"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
disable_bgp_route_propagation = false
route {
name = "route1"
address_prefix = "10.1.0.0/16"
next_hop_type = "VnetLocal"
}
tags = {
environment = "Production"
}
}
The following arguments are supported:
name
- (Required) The name of the route table. 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 table. Changing this forces a new resource to be created.
location
- (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
route
- (Optional) List of route
objects representing routes as defined below. Each object accepts the arguments documented below.
disable_bgp_route_propagation
- (Optional) Boolean flag which controls propagation of routes learned by BGP on that route table. True means disable.
tags
- (Optional) A mapping of tags to assign to the resource.
A route
block support:
name
- (Required) The name of the route.
address_prefix
- (Required) 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
- (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
.
In addition to the Arguments listed above - the following Attributes are exported:
id
- The Route Table ID.subnets
- The collection of Subnets associated with this route table.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Route Table.update
- (Defaults to 30 minutes) Used when updating the Route Table.read
- (Defaults to 5 minutes) Used when retrieving the Route Table.delete
- (Defaults to 30 minutes) Used when deleting the Route Table.Route Tables can be imported using the resource id
, e.g.
terraform import azurerm_route_table.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/routeTables/mytable1