pagerduty_service_event_rule

A service event rule allows you to set actions that should be taken on events for a service that meet the designated rule criteria.

Example Usage

resource "pagerduty_service" "example" {
  name                    = "Checkout API Service"
  auto_resolve_timeout    = 14400
  acknowledgement_timeout = 600
  escalation_policy       = pagerduty_escalation_policy.example.id
  alert_creation          = "create_alerts_and_incidents"
}

resource "pagerduty_service_event_rule" "foo" {
  service  = pagerduty_service.example.id
  position = 0
  disabled = true

  conditions {
    operator = "and"

    subconditions {
      operator = "contains"

      parameter {
        value = "disk space"
        path  = "summary"
      }
    }
  }

  variable {
    type = "regex"
    name = "Src"

    parameters {
      value = "(.*)"
      path  = "source"
    }
  }

  actions {

    annotate {
      value = "From Terraform"
    }

    extractions {
      target = "dedup_key"
      source = "source"
      regex  = "(.*)"
    }

    extractions {
      target   = "summary"
      template = "Warning: Disk Space Low on {{Src}}"
    }
  }
}

resource "pagerduty_service_event_rule" "bar" {
  service  = pagerduty_service.foo.id
  position = 1
  disabled = true

  conditions {
    operator = "and"

    subconditions {
      operator = "contains"

      parameter {
        value = "cpu spike"
        path  = "summary"
      }
    }
  }

  actions {
    annotate {
      value = "From Terraform"
    }
  }
}

Argument Reference

The following arguments are supported:

Conditions (conditions) supports the following:

Sub-Conditions (subconditions) supports the following:

Action (actions) supports the following:

Variable ('variable') supports the following:

Time Frame (time_frame) supports the following:

Attributes Reference

The following attributes are exported:

Import

Service event rules can be imported using using the related service id and the service_event_rule id separated by a dot, e.g.

$ terraform import pagerduty_service_event_rule.main a19cdca1-3d5e-4b52-bfea-8c8de04da243.19acac92-027a-4ea0-b06c-bbf516519601