Skip to content

Commit ea22fa5

Browse files
chkp-eddiekchkp-natanelm
authored andcommitted
Azure TF templates | Aligned route tables
1 parent cd57f51 commit ea22fa5

File tree

1 file changed

+5
-2
lines changed
  • terraform/azure/modules/vnet

1 file changed

+5
-2
lines changed

terraform/azure/modules/vnet/main.tf

+5-2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ locals { // locals for 'next_hop_type' allowed values
3636
"VirtualAppliance",
3737
"None"
3838
]
39+
address_prefix_length = length(var.subnet_prefixes[0])
3940
}
4041

4142
resource "azurerm_route_table" "frontend" {
@@ -51,7 +52,8 @@ resource "azurerm_route_table" "frontend" {
5152
route {
5253
name = "To-Internal"
5354
address_prefix = var.address_space
54-
next_hop_type = local.next_hop_type_allowed_values[4]
55+
next_hop_type = local.next_hop_type_allowed_values[3]
56+
next_hop_in_ip_address = substr(replace(azurerm_subnet.subnet[0].address_prefixes[0], "0/", "4/"), 0, local.address_prefix_length - 3)
5557
}
5658
}
5759

@@ -69,7 +71,8 @@ resource "azurerm_route_table" "backend" {
6971
route {
7072
name = "To-Internet"
7173
address_prefix = "0.0.0.0/0"
72-
next_hop_type = local.next_hop_type_allowed_values[4]
74+
next_hop_type = local.next_hop_type_allowed_values[3]
75+
next_hop_in_ip_address = substr(replace(azurerm_subnet.subnet[1].address_prefixes[0], "0/", "4/"), 0, local.address_prefix_length - 3)
7376
}
7477
}
7578

0 commit comments

Comments
 (0)