pagerduty_user_notification_rule

A notification rule configures where and when a PagerDuty user is notified when a triggered incident is assigned to them. Unique notification rules can be created for both high and low-urgency incidents.

Example Usage

resource "pagerduty_user" "example" {
  name  = "Earline Greenholt"
  email = "125.greenholt.earline@graham.name"
}

resource "pagerduty_user_contact_method" "email" {
  user_id = pagerduty_user.example.id
  type    = "email_contact_method"
  address = "foo@bar.com"
  label   = "Work"
}

resource "pagerduty_user_contact_method" "phone" {
  user_id      = pagerduty_user.example.id
  type         = "phone_contact_method"
  country_code = "+1"
  address      = "2025550199"
  label        = "Work"
}

resource "pagerduty_user_contact_method" "sms" {
  user_id      = pagerduty_user.example.id
  type         = "sms_contact_method"
  country_code = "+1"
  address      = "2025550199"
  label        = "Work"
}

resource "pagerduty_user_notification_rule" "high_urgency_phone" {
  user_id                = pagerduty_user.example.id
  start_delay_in_minutes = 1
  urgency                = "high"

  contact_method = {
    type = "phone_contact_method"
    id   = pagerduty_user_contact_method.phone.id
  }
}

resource "pagerduty_user_notification_rule" "low_urgency_email" {
  user_id                = pagerduty_user.example.id
  start_delay_in_minutes = 1
  urgency                = "low"

  contact_method = {
    type = "email_contact_method"
    id   = pagerduty_user_contact_method.email.id
  }
}

resource "pagerduty_user_notification_rule" "low_urgency_sms" {
  user_id                = pagerduty_user.example.id
  start_delay_in_minutes = 10
  urgency                = "low"

  contact_method = {
    type = "sms_contact_method"
    id   = pagerduty_user_contact_method.sms.id
  }
}

Argument Reference

The following arguments are supported:

Contact methods (contact_method) supports the following:

Attributes Reference

The following attributes are exported:

Import

User notification rules can be imported using the user_id and the id, e.g.

$ terraform import pagerduty_user_notification_rule.main PXPGF42:PPSCXAN