Skip to content

Commit d546edc

Browse files
authored
Merge pull request #126 from PerfectThymeTech/marvinbuss/service_health_alert
Add service health alerting
2 parents b8c6073 + a689041 commit d546edc

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

code/infra/alerts.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
resource "azurerm_monitor_activity_log_alert" "monitor_activity_log_alert_service_health" {
2+
name = "${local.prefix}-alert-servicehealth"
3+
resource_group_name = azurerm_resource_group.logging_rg.name
4+
tags = var.tags
5+
6+
enabled = true
7+
description = "Alerts about service health and maintenance events."
8+
scopes = [
9+
data.azurerm_subscription.current.id
10+
]
11+
action {
12+
action_group_id = azurerm_monitor_action_group.monitor_action_group.id
13+
webhook_properties = {
14+
"alert-type" = "service-health",
15+
"location" = var.location
16+
"environment" = var.environment
17+
"subscription" = data.azurerm_client_config.current.subscription_id
18+
"severity" = "Info"
19+
}
20+
}
21+
criteria {
22+
category = "ServiceHealth"
23+
service_health {
24+
events = [
25+
"Incident",
26+
"Maintenance"
27+
]
28+
locations = [
29+
"Global",
30+
data.azurerm_location.current.display_name
31+
]
32+
}
33+
}
34+
}

code/infra/data.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
data "azurerm_client_config" "current" {}
22

3+
data "azurerm_subscription" "current" {}
4+
5+
data "azurerm_location" "current" {
6+
location = var.location
7+
}
8+
39
data "azurerm_virtual_network" "virtual_network" {
410
name = local.virtual_network.name
511
resource_group_name = local.virtual_network.resource_group_name

0 commit comments

Comments
 (0)