Azure route table Terraform module
Terraform module for route table creation with routes and subnet associations.
This module is provisioning route table with routes and subnet associations. Below is an example that provisions route table with three routes.
locals {
routes = {
" route1" = {
address_prefix = " 10.0.0.0/16"
next_hop_type = " VirtualAppliance"
next_hop_ip = " 10.2.0.3"
}
" route2" = {
address_prefix = " 10.1.0.0/16"
next_hop_type = " VirtualNetworkGateway"
}
" route3" = {
address_prefix = " 10.2.0.0/16"
next_hop_type = " VnetLocal"
}
}
}
data "azurerm_subnet" "subnet1" {
name = " subnet1"
virtual_network_name = " example-vnet"
resource_group_name = " example-rg"
}
data "azurerm_subnet" "subnet2" {
name = " subnet2"
virtual_network_name = " example-vnet"
resource_group_name = " example-rg"
}
module "route_table" {
source = " data-platform-hq/route-table/azurerm"
route_table_name = " example-route-table"
location = var. location
resource_group = var. resource_group
subnet_ids = {
(data. azurerm_subnet . subnet1 . name ) = data.azurerm_subnet.subnet1.id
(data. azurerm_subnet . subnet2 . name ) = data.azurerm_subnet.subnet2.id
}
routes = local. routes
}
No modules.
Name
Description
Type
Default
Required
bgp_route_propagation_enabled
Boolean flag which controls propagation of routes learned by BGP on that route table. True means enable.
bool
false
no
location
Specifies the supported Azure location where the resource exists
string
n/a
yes
resource_group
The name of the resource group in which to create the route table
string
n/a
yes
route_table_name
Route table name
string
n/a
yes
routes
Map of route names to its address_prefix, next_hop_type
map(object({ address_prefix = string next_hop_type = string next_hop_ip = optional(string) }))
{}
no
subnet_ids
Maps of subnet name to id, route table would associated to this subnets
map(string)
{}
no
tags
Resource tags
map(any)
{}
no
Name
Description
route_table
Map of route table name to ID
Apache 2 Licensed. For more information please see LICENSE