可以使用 Terraform 为 Azure Functions 配置健康检查吗?

Possible to configure Health Check for Azure Functions with Terraform?

我有 Terraform 部署 Azure Functions。现在我想用 Terraform 添加健康检查? 如何开启,加上url和时间?

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

如果您在 site_config block 下设置 path for health check

Health Check 会自动启用。但是没有参数来配置来自 terraform 的 load balancing time

我通过添加带有 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
  }
}

输出: