Azure Network Route Table
This page shows how to write Terraform and Azure Resource Manager for Network Route Table and write them securely.
azurerm_virtual_hub_route_table (Terraform)
The Route Table in Network can be configured in Terraform with the resource name azurerm_virtual_hub_route_table
. The following sections describe 9 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "azurerm_virtual_hub_route_table" "Red_H1" {
name = "Red"
labels = ["Red"]
virtual_hub_id = data.azurerm_virtual_hub.VH_R1.id
}
resource "azurerm_virtual_hub_route_table" "Red_H1" {
name = "Red"
virtual_hub_id = data.azurerm_virtual_hub.VH_R1.id
}
resource "azurerm_virtual_hub_route_table" "Blue_H1" {
resource "azurerm_virtual_hub_route_table" "Red_H1" {
name = "Red"
virtual_hub_id = data.azurerm_virtual_hub.VH_R1.id
}
resource "azurerm_virtual_hub_route_table" "Blue_H1" {
resource "azurerm_virtual_hub_route_table" "westeu_vHub_rtb" {
name = "westeu_vHub_RTB"
virtual_hub_id = azurerm_virtual_hub.westeu_vHub.id
}
////////////// EAST US
resource "azurerm_virtual_hub_route_table" "Red" {
name = "Red"
virtual_hub_id = data.azurerm_virtual_hub.VH_R1.id
}
resource "azurerm_virtual_hub_route_table" "Blue" {
resource "azurerm_virtual_hub_route_table" "route_table" {
for_each = local.networking.virtual_hub_route_tables
name = each.value.name
virtual_hub_id = coalesce(
resource "azurerm_virtual_hub_route_table" "virtual_hub_route_table" {
for_each = var.virtual_hub_route_tables
labels = lookup(each.value, "labels", null) != null ? split(",", replace(lookup(each.value, "labels", null), " ", "")) : []
name = each.key
virtual_hub_id = azurerm_virtual_hub.virtual_hub[lookup(each.value, "virtual_hub_name", null)].id
resource "azurerm_virtual_hub_route_table" "route_table" {
for_each = local.networking.virtual_hub_route_tables
name = each.value.name
virtual_hub_id = coalesce(
resource "azurerm_virtual_hub_route_table" "route_table" {
for_each = local.networking.virtual_hub_route_tables
name = each.value.name
virtual_hub_id = coalesce(
Parameters
-
id
optional computed - string -
labels
optional - set of string -
name
required - string -
virtual_hub_id
required - string -
route
set block-
destinations
required - set of string -
destinations_type
required - string -
name
required - string -
next_hop
required - string -
next_hop_type
optional - string
-
-
timeouts
single block
Explanation in Terraform Registry
Manages a Virtual Hub Route Table.
Tips: Best Practices for The Other Azure Network Resources
In addition to the azurerm_network_security_group, Azure Network has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.
azurerm_network_security_group
Ensure to disable RDP port from the Internet
It is better to disable the RDP port from the Internet. RDP access should not be accepted from the Internet (*, 0.0.0.0, /0, internet, any), and consider using the Azure Bastion Service.
azurerm_network_security_rule
Ensure to set a more restrictive CIDR range for ingress from the internet
It is better to set a more restrictive CIDR range not to use very broad subnets. If possible, segments should be divided into smaller subnets.
azurerm_network_watcher_flow_log
Ensure to enable Retention policy for flow logs and set it to enough duration
It is better to enable a retention policy for flow logs. Flow logs show us all network activity in the cloud environment and support us when we face critical incidents.
Microsoft.Network/virtualHubs/hubRouteTables (Azure Resource Manager)
The virtualHubs/hubRouteTables in Microsoft.Network can be configured in Azure Resource Manager with the resource name Microsoft.Network/virtualHubs/hubRouteTables
. The following sections describe how to use the resource and its parameters.
Example Usage from GitHub
An example could not be found in GitHub.
Parameters
name
required - stringtype
required - stringapiVersion
required - stringproperties
requiredroutes
optional arrayname
required - stringThe name of the Route that is unique within a RouteTable. This name can be used to access this route.
destinationType
required - stringThe type of destinations (eg: CIDR, ResourceId, Service).
destinations
required - arrayList of all destinations.
nextHopType
required - stringThe type of next hop (eg: ResourceId).
nextHop
required - stringNextHop resource ID.
labels
optional - arrayList of labels associated with this route table.
Frequently asked questions
What is Azure Network Route Table?
Azure Network Route Table is a resource for Network of Microsoft Azure. Settings can be wrote in Terraform.
Where can I find the example code for the Azure Network Route Table?
For Terraform, the ipspace/pubcloud, ipspace/pubcloud and ipspace/pubcloud source code examples are useful. See the Terraform Example section for further details.