Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure outage alert #1458

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions operations/template/alert.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,48 @@ resource "azurerm_monitor_action_group" "notify_slack_email" {
}
}

resource "azurerm_monitor_activity_log_alert" "azure_service_health_alert" {
count = local.non_pr_environment ? 1 : 0
name = "cdcti-${var.environment}-azure-status-alert"
location = data.azurerm_resource_group.group.location
resource_group_name = data.azurerm_resource_group.group.name
scopes = [azurerm_container_registry.registry.id]

criteria {
category = "ServiceHealth"
levels = ["Error"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using a variable for the alert level to allow flexibility in configuration without code changes. [important]

service_health {
locations = var.service_health_locations
events = ["Incident"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's recommended to externalize the service events into a variable to enhance the flexibility and maintainability of the alert configurations. [important]

services = ["*"]
}
}

action {
action_group_id = azurerm_monitor_action_group.notify_slack_email[count.index].id
}

description = "Alert service(s) appear to be down"
enabled = true

lifecycle {
ignore_changes = [
tags["business_steward"],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validate if the lifecycle ignore_changes configuration is necessary for all these tags, as it might lead to overlooking important changes. [medium]

tags["center"],
tags["environment"],
tags["escid"],
tags["funding_source"],
tags["pii_data"],
tags["security_compliance"],
tags["security_steward"],
tags["support_group"],
tags["system"],
tags["technical_steward"],
tags["zone"]
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "database_token_expired_alert" {
count = local.non_pr_environment ? 1 : 0
name = "cdcti-${var.environment}-api-log-token-alert"
Expand Down
5 changes: 5 additions & 0 deletions operations/template/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ variable "alert_slack_email" {
nullable = false
sensitive = true
}

variable "service_health_locations" {
type = list(string)
default = ["East US"]
}
Loading