Skip to content

Commit

Permalink
Add dimention and frequncy config
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtiomMatiom committed Dec 2, 2024
1 parent 0e2d066 commit 5d6192b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion modules/azure/monitoring_metric_alert/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,21 @@ resource "azurerm_monitor_metric_alert" "metric_alert" {
description = each.value.description
severity = each.value.severity
enabled = each.value.enabled

frequency = each.value.frequency
window_size = each.value.window_size

criteria {
metric_namespace = each.value.metric_namespace
metric_name = each.value.metric_name
aggregation = each.value.aggregation
operator = each.value.operator
threshold = each.value.threshold

dimension {
name = each.value.dimension.name
operator = each.value.dimension.operator
values = each.value.dimension.values
}
}

action {
Expand Down
7 changes: 7 additions & 0 deletions modules/azure/monitoring_metric_alert/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@ variable "monitoring_rules" {
aggregation = string
operator = string
threshold = number
frequency = optional(string)
window_size = optional(string)
auto_mitigation_enabled = optional(bool)
severity = optional(number)
enabled = optional(bool)
dimension = optional(object({
name = string,
operator = string,
values = list(string)
}))
}))
description = "A list of metricts we want to monitor. For details see https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_metric_alert#argument-reference"
default = []
Expand Down

0 comments on commit 5d6192b

Please sign in to comment.