可以使用 Terraform 配置 Azure Functions 的运行状况检查吗?

Ken*_*y_I 7 terraform azure-functions

我有 Terraform 部署 Azure Functions。现在我想使用 Terraform 添加健康检查?如何启用它,添加网址和时间?

https://learn.microsoft.com/en-us/azure/app-service/monitor-instances-health-check

Ans*_*-MT 12

path for health check如果您设置了under ,健康检查将自动启用site_config block。但是没有参数可以配置load balancing timefrom terraform。

我通过添加带有 health_check_path 的 site_config 块来测试它:

resource "azurerm_function_app" "example" {
  name                       = "terraform-azure-functions"
  location                   = azurerm_resource_group.example.location
  resource_group_name        = azurerm_resource_group.example.name
  app_service_plan_id        = azurerm_app_service_plan.example.id
  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
  site_config{
  health_check_path          = "/api/health" # need to configure for enabling Health check
  }
}
Run Code Online (Sandbox Code Playgroud)

输出:

在此输入图像描述

在此输入图像描述