我试图通过Terraform为Azure创建路由,并希望下一个防火墙的私有IP地址作为下一跳地址。但没有编码工作。
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"
}
1条答案
按热度按时间wfypjpf41#
我已经在我的环境中复制了,并得到了预期的结果如下:
以下是我使用路由表创建Azure防火墙的代码,并遵循Document1和Document2:
输出:
执行terraform代码后创建的资源:
成功运行上述代码后,将使用以下IP地址创建路由表:
在Firewall中: