hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.58k stars 4.62k forks source link

Support for auto_heal_setting on the resource azurerm_windows_function_app and azurerm_windows_function_app_slot #21426

Open JamesDLD opened 1 year ago

JamesDLD commented 1 year ago

Is there an existing issue for this?

Community Note

Description

Auto-Healing is a mitigation action that can be taken when an app is having unexpected behavior. It can be triggered based on request count, slow request, memory limit, and HTTP status code.

It has been implemented on both resources azurerm_windows_web_app & azurerm_windows_web_app_slot but not on azurerm_windows_function_app & azurerm_windows_function_app_slot.

New or Affected Resource(s)/Data Source(s)

azurerm_windows_function_app

Potential Terraform Configuration

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_storage_account" "example" {
  name                     = "windowsfunctionappsa"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_service_plan" "example" {
  name                = "example-app-service-plan"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  os_type             = "Windows"
  sku_name            = "Y1"
}

resource "azurerm_windows_function_app" "example" {
  name                = "example-windows-function-app"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  storage_account_name       = azurerm_storage_account.example.name
  storage_account_access_key = azurerm_storage_account.example.primary_access_key
  service_plan_id            = azurerm_service_plan.example.id

  site_config {

    auto_heal_enabled = true
    auto_heal_setting {
      action {
        action_type                    = "Recycle"
        minimum_process_execution_time = "00:00:00"
      }

      trigger {
        status_code {
          count             = 3
          interval          = "00:00:05"
          path              = "/HealtCheck"
          status_code_range = "503"
          sub_status        = 0
        }
      }
    }
  }

}

References

xiaxyi commented 1 year ago

Thanks @JamesDLD for raising this issue, let me check this feature first. Once confirmed, I'll add it to our backlog.

wozorio commented 4 days ago

It would be also nice to have support added to the azurerm_linux_function_app resource.