Kenny_I
Kenny_I

Reputation: 2513

Possible to configure Health Check for Azure Functions with Terraform?

I have Terraform deploying Azure Functions. Now I would like to add health check with Terraform? How to enable it, add url and time?

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

Upvotes: 7

Views: 3707

Answers (1)

Ansuman Bal
Ansuman Bal

Reputation: 11421

Health Check gets automatically enabled if you set the path for health check under site_config block. But there is no parameter to configure the load balancing time from terraform.

I tested it by adding the site_config block with health_check_path:

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
  }
}

Outputs:

enter image description here

enter image description here

Upvotes: 12

Related Questions