Adding severity rule for resource dynatrace alerting profile


I am trying to add a severity rule to my existing dynatrace alerting profiles. Here is how I am creating alerting profile resources (for multiple teams):

resource "dynatrace_alerting_profile" "team_alerts" {
  display_name = "${var.team_name} team alerts"
  mz_id        = var.management_zone_id
  dynamic "rules" {
    for_each = var.severity_rules
    content {
      delay_in_minutes = rules.value["delay_in_minutes"]
      severity_level   = rules.value["severity_level"]
      tag_filter {
        include_mode = rules.value["tag"]

Currently the variable severity_rule’s is empty like this:

variable "severity_rules" {
  type        = list
  description = "List of severity rules"
  default     = []

I need help to understand how i should be adding severity rules to ensure it gets created when the resource “dynatrace alerting profile is created”. So far I have attempted this and tried modifying severity rules like this to make it work:

variable "severity_rules" {
  type = map(object({
    severity_level = string
    delay_in_minutes  = number
    tag       = string
  default = {
    "x_rule" = {
      severity_level = "ERROR"
      delay_in_minutes  = 5
      tag       = "test"

Great! And, what happens next? Seems reasonable-ish to me at first glance.

well, apologies for delay in response. We changed the way how our resources are setup for creating alerting profiles and so I have to first attempt on it.

I will revert back here on how that goes :slightly_smiling_face: