terraform-provider-azureazure-front-door

Terraform resource group name for the creation of alerts for azure front door


Implementing an alert through terraform for the azure frontdoor status.

having an example for the virtual machines

  name                = "resource_health_alert"
  description         = "Resource Health Alerts"
  resource_group_name = var.resource_group_name
  scopes              = [var.scope]
  criteria {
    resource_id    = var.resource_id
    category       = "ResourceHealth"
    resource_type  = "microsoft.compute/Virtual machines" 
    resource_group = ""
    resource_health {
         current = ["Degraded","Unavailable","Unknown"]
         previous = ["Available"]
         reason = ["PlatformInitiated","UserInitiated","Unknown"]
    }
  }
  action {
    action_group_id = var.action_group_id
  }
  tags = var.tags
}

but looking for the front door proper resource type to trigger an alerts


Solution

  • Creating the alerts for azure front door using terraform

    Since the configuration has nothing to match with the required as it requirement relates with Azure frond door but not virtual machines.

    As @VenkatV mentioned Need to make some changes respect to resource type and parameters inside resource health as mentioned below to achieve this requirement.

    Configuration:

    resource "azurerm_monitor_activity_log_alert" "res-7" {
      name                = "Frontdoorstatusalert1"
      resource_group_name = "vinay-webapp"
      location            = "Global "
      scopes              = ["/subscriptions/Sub_ID"]
      action {
        action_group_id = "/subscriptions/Sub_ID/resourcegroups/vinay-webapp/providers/microsoft.insights/actiongroups/application insights smart detection"
      }
      criteria {
        category        = "ResourceHealth"
        resource_groups = ["vinay-webapp"]
        resource_ids    = ["/subscriptions/Sub_ID/resourceGroups/vinay-webapp/providers/Microsoft.Cdn/profiles/vinayfrontdoor"]
        resource_types  = ["Microsoft.Cdn/profiles"]
        resource_health {
             current = ["Degraded","Unavailable","Available"]
             previous = ["Available"]
             reason = ["PlatformInitiated","UserInitiated","Unknown"]  
        }
      }
    }
    

    Deployment:

    enter image description here

    Refer:

    azurerm_monitor_activity_log_alert | Resources | hashicorp/azurerm | Terraform | Terraform Registry