Skip to content

Commit

Permalink
Adding action group
Browse files Browse the repository at this point in the history
  • Loading branch information
frasermolyneux committed Dec 23, 2024
1 parent 71536f1 commit a511926
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
45 changes: 45 additions & 0 deletions terraform/data.monitor_action_groups.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
provider "azurerm" {
alias = "azure_monitor"
subscription_id = var.environment == "prd" ? "7760848c-794d-4a19-8cb2-52f71a21ac2b" : "d68448b0-9947-46d7-8771-baa331a3063a"
features {}
storage_use_azuread = true
}

locals {
azure_monitor_resource_group = "rg-platform-monitoring-${var.environment}-uksouth"
}

data "azurerm_monitor_action_group" "critical" {
provider = azurerm.azure_monitor

name = "p0-critical-alerts-${var.environment}"
resource_group_name = local.azure_monitor_resource_group
}

data "azurerm_monitor_action_group" "high" {
provider = azurerm.azure_monitor

name = "p1-high-alerts-${var.environment}"
resource_group_name = local.azure_monitor_resource_group
}

data "azurerm_monitor_action_group" "moderate" {
provider = azurerm.azure_monitor

name = "p2-moderate-alerts-${var.environment}"
resource_group_name = local.azure_monitor_resource_group
}

data "azurerm_monitor_action_group" "low" {
provider = azurerm.azure_monitor

name = "p3-low-alerts-${var.environment}"
resource_group_name = local.azure_monitor_resource_group
}

data "azurerm_monitor_action_group" "informational" {
provider = azurerm.azure_monitor

name = "p4-informational-alerts-${var.environment}"
resource_group_name = local.azure_monitor_resource_group
}
4 changes: 4 additions & 0 deletions terraform/resource_health_alerts.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@ resource "azurerm_monitor_activity_log_alert" "rg_resource_health" {
}
}

action {
action_group_id = var.environment == "prd" ? data.azurerm_monitor_action_group.critical.id : data.azurerm_monitor_action_group.informational.id
}

tags = var.tags
}

0 comments on commit a511926

Please sign in to comment.