I am trying to create Route for Azure through Terraform and and wants to next Firewall's private IP address as next hop address. But none of the coding is working.
resource "azurerm_firewall" "Fireall-variable" {
name = "Main-Firewall"
location = azurerm_resource_group.East-rg-variable.location
resource_group_name = azurerm_resource_group.East-rg-variable.name
sku_name = "AZFW_VNet"
sku_tier = "Standard"
ip_configuration {
name = "configuration"
subnet_id = azurerm_subnet.subnet2.id
public_ip_address_id = azurerm_public_ip.Firewallip-variable.id
}
}
resource "azurerm_route_table" "westroute" {
name = "West-route-table"
location = azurerm_resource_group.East-rg-variable.location
resource_group_name = azurerm_resource_group.East-rg-variable.name
disable_bgp_route_propagation = false
route {
name = "route1"
address_prefix = "0.0.0.0/0"
next_hop_type = "VirtualAppliance"
next_hop_in_ip_address = "10.0.1.4"
}
I have reproduced in my environment and got expected results as below:
Here is the code with which I created Azure Firewall with route table and I followed Document1 and Document2:
Output:
Resources created after executing terraform code:
After running the above code successfully, Route table is created with the below IP Address:
Now in Firewall: