PagerDuty / terraform-provider-pagerduty

Terraform PagerDuty provider
https://www.terraform.io/docs/providers/pagerduty/
Mozilla Public License 2.0
204 stars 208 forks source link

Add support for user handoff notification rules #875

Closed imjaroiswebdev closed 1 month ago

imjaroiswebdev commented 1 month ago

Add support for User Handoff Notification Rules

This is how it will work...

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

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_handoff_notification_rule" "example-oncall-offcall" {
  user_id                   = pagerduty_user.example.id
  handoff_type              = "both"
  notify_advance_in_minutes = 180
  contact_method {
    id   = pagerduty_user_contact_method.phone.id
    type = pagerduty_user_contact_method.phone.type
  }
}

Documentation preview

image

New acceptance tests introduced...

TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -count=1 -run TestAccPagerDutyUserHandoffNotificationRule -timeout 120m
?       github.com/PagerDuty/terraform-provider-pagerduty       [no test files]
testing: warning: no tests to run
PASS
ok      github.com/PagerDuty/terraform-provider-pagerduty/pagerduty     0.539s [no tests to run]
=== RUN   TestAccPagerDutyUserHandoffNotificationRule_import
--- PASS: TestAccPagerDutyUserHandoffNotificationRule_import (13.42s)
=== RUN   TestAccPagerDutyUserHandoffNotificationRule_Basic
--- PASS: TestAccPagerDutyUserHandoffNotificationRule_Basic (17.20s)
PASS
ok      github.com/PagerDuty/terraform-provider-pagerduty/pagerdutyplugin       31.362s
testing: warning: no tests to run
PASS
ok      github.com/PagerDuty/terraform-provider-pagerduty/util  0.837s [no tests to run]

⚠️ Depends on...

https://github.com/PagerDuty/go-pagerduty/pull/528 must be merged before moving on with this PR merge.