-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
25 lines (21 loc) · 888 Bytes
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
resource "azurerm_route_table" "this" {
name = var.route_table_name
location = var.location
resource_group_name = var.resource_group
bgp_route_propagation_enabled = var.bgp_route_propagation_enabled
tags = var.tags
}
resource "azurerm_route" "this" {
for_each = var.routes
name = each.key
resource_group_name = var.resource_group
route_table_name = azurerm_route_table.this.name
address_prefix = each.value.address_prefix
next_hop_type = each.value.next_hop_type
next_hop_in_ip_address = each.value.next_hop_type == "VirtualAppliance" ? each.value.next_hop_ip : null
}
resource "azurerm_subnet_route_table_association" "this" {
for_each = var.subnet_ids
subnet_id = each.value
route_table_id = azurerm_route_table.this.id
}