Search code examples
terraformterraform-provider-azure

Setting auto heal for azure web app using terraform


I am trying to setup auto heal settings for azure web app using terraform

what have i tried ?

How can I figure out a reference example to setup triggers and actions for the auto_heal_settings mentioned in the documentation here


Solution

  • I was able to figure out an example for auto-heal by adding auto heal settings manually using the azure portal and then running terraform plan which showed me the exact synatax of the auto_heal_settings the plan was going to remove.

    This setting shows configuration to recycle your web app when either

    • 5000 requests to /HealthCheck throw 500 in 5 min (300 seconds)
    • 5000 requests to /Get throw 500 in 5 min (300 seconds)

    ^ might not be the right settings for your application in production, however the strategy of figuring out settings can be applied to all scenarios supported by this feature

      - auto_heal_setting {
                  - action {
                      - action_type                    = "Recycle" -> null
                      - minimum_process_execution_time = "00:00:00" -> null
                    }
    
                  - trigger {
                      - private_memory_kb = 0 -> null
    
                      - status_code {
                          - count             = 5000 -> null
                          - interval          = "00:05:00" -> null
                          - path              = "/HealtCheck" -> null
                          - status_code_range = "500" -> null
                          - sub_status        = 0 -> null
                        }
                      - status_code {
                          - count             = 6000 -> null
                          - interval          = "00:05:00" -> null
                          - path              = "/Get" -> null
                          - status_code_range = "500" -> null
                          - sub_status        = 0 -> null
                        }
                    }