Skip to content

Commit

Permalink
Refactor: alert suppression rule block (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman authored Dec 6, 2023
2 parents 2cf865c + b20b223 commit f6ac377
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 47 deletions.
37 changes: 0 additions & 37 deletions terraform/suppress.arm.json

This file was deleted.

21 changes: 11 additions & 10 deletions terraform/uptime.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ module "healthcheck" {

# ignore when app restarts as data is being reloaded
# https://learn.microsoft.com/en-us/azure/azure-monitor/alerts/alerts-processing-rules
# the Terraform resource doesn't support time windows, so need to drop down to an ARM template instead
# https://github.com/hashicorp/terraform-provider-azurerm/issues/16726
resource "azurerm_resource_group_template_deployment" "suppress_nightly_downtime" {
resource "azurerm_monitor_alert_processing_rule_suppression" "suppress_nightly_downtime" {
name = "suppress-nightly-downtime"
description = "Suppresses alerts during the scheduled nightly downtime"
resource_group_name = data.azurerm_resource_group.main.name
deployment_mode = "Incremental"
parameters_content = jsonencode({
"metricAlertID" = {
value = module.healthcheck.metric_alert_id
scopes = [module.healthcheck.metric_alert_id]
schedule {
time_zone = "Pacific Standard Time"
recurrence {
daily {
start_time = "02:55:00"
end_time = "03:30:00"
}
}
})
# https://learn.microsoft.com/en-us/azure/templates/microsoft.alertsmanagement/actionrules?tabs=json&pivots=deployment-language-arm-template
template_content = file("${path.module}/suppress.arm.json")
}
}

0 comments on commit f6ac377

Please sign in to comment.