我不明白为什么会收到此错误?
Error: Error Creating/Updating Application Gateway "apgw-ngd-mig-01" (Resource Group "rg-ngd-mig-inf-01"): network.ApplicationGatewaysClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidResourceReference" Message="Resource /subscriptions/5397f7a7-fbed-4dd5-bf06-151e8ca58ba7/resourceGroups/rg-ngd-mig-inf-01/providers/Microsoft.Network/applicationGateways/apgw-ngd-mig-01/urlPathMaps/value referenced by resource /subscriptions/5397f7a7-fbed-4dd5-bf06-151e8ca58ba7/resourceGroups/rg-ngd-mig-inf-01/providers/Microsoft.Network/applicationGateways/apgw-ngd-mig-01/requestRoutingRules/default-Rule was not found. Please make sure that the referenced resource
exists, and that both resources are in the same region." Details=[]
on appgw\main.tf line 1, in resource "azurerm_application_gateway" "apgw":
1: resource "azurerm_application_gateway" "apgw" {
有什么建议吗?
答案 0 :(得分:0)
错误消息指示未找到资源urlPathMaps/value
引用的资源requestRoutingRules/default-Rule
。您可以检查在url_path_map_name
块中是否引用了正确的request_routing_rule
。
以下是相关的Terraform代码供您参考
frontend_port {
name = "port_name2"
port = 8080
}
http_listener {
name = "listener2"
frontend_ip_configuration_name = local.frontend_ip_configuration_name
frontend_port_name = "port_name2"
protocol = "Http"
}
request_routing_rule {
name = "rule_2"
rule_type = "PathBasedRouting"
http_listener_name = "listener2"
backend_address_pool_name = local.backend_address_pool_name
backend_http_settings_name = local.http_setting_name
url_path_map_name = "urlmap"
}
url_path_map {
name = "urlmap"
default_backend_address_pool_name = local.backend_address_pool_name
default_backend_http_settings_name = local.http_setting_name
path_rule {
name = "test"
paths = ["/path1/"]
backend_address_pool_name = local.backend_address_pool_name
backend_http_settings_name = local.http_setting_name
}
}