Skip to content

Commit

Permalink
Azure TF templates | Aligned route tables
Browse files Browse the repository at this point in the history
  • Loading branch information
chkp-eddiek authored and chkp-natanelm committed Nov 28, 2024
1 parent cd57f51 commit ea22fa5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions terraform/azure/modules/vnet/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ locals { // locals for 'next_hop_type' allowed values
"VirtualAppliance",
"None"
]
address_prefix_length = length(var.subnet_prefixes[0])
}

resource "azurerm_route_table" "frontend" {
Expand All @@ -51,7 +52,8 @@ resource "azurerm_route_table" "frontend" {
route {
name = "To-Internal"
address_prefix = var.address_space
next_hop_type = local.next_hop_type_allowed_values[4]
next_hop_type = local.next_hop_type_allowed_values[3]
next_hop_in_ip_address = substr(replace(azurerm_subnet.subnet[0].address_prefixes[0], "0/", "4/"), 0, local.address_prefix_length - 3)
}
}

Expand All @@ -69,7 +71,8 @@ resource "azurerm_route_table" "backend" {
route {
name = "To-Internet"
address_prefix = "0.0.0.0/0"
next_hop_type = local.next_hop_type_allowed_values[4]
next_hop_type = local.next_hop_type_allowed_values[3]
next_hop_in_ip_address = substr(replace(azurerm_subnet.subnet[1].address_prefixes[0], "0/", "4/"), 0, local.address_prefix_length - 3)
}
}

Expand Down

0 comments on commit ea22fa5

Please sign in to comment.