Skip to content

Commit

Permalink
Merge pull request #875 from imjaroiswebdev/support-user-handoff-notif
Browse files Browse the repository at this point in the history
Add support for user handoff notification rules
  • Loading branch information
imjaroiswebdev authored May 27, 2024
2 parents de61b16 + b4e1e40 commit a90d94f
Show file tree
Hide file tree
Showing 46 changed files with 3,195 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/PagerDuty/terraform-provider-pagerduty
go 1.20

require (
github.com/PagerDuty/go-pagerduty v1.8.1-0.20240402164006-de82e6b1f7cf
github.com/PagerDuty/go-pagerduty v1.8.1-0.20240524180345-9b652f07c450
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hc-install v0.6.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/PagerDuty/go-pagerduty v1.8.1-0.20240402164006-de82e6b1f7cf h1:AUgxH50piqC1t68No19H3l2kOfBD3/jrMWfPmqOwcgU=
github.com/PagerDuty/go-pagerduty v1.8.1-0.20240402164006-de82e6b1f7cf/go.mod h1:ilimTqwHSBjmvKeYA/yayDBZvzf/CX4Pwa9Qbhekzok=
github.com/PagerDuty/go-pagerduty v1.8.1-0.20240524180345-9b652f07c450 h1:G8EOmgL7i+vO6hYAnjpVbPDqUpPY7ThF6NfasZntop0=
github.com/PagerDuty/go-pagerduty v1.8.1-0.20240524180345-9b652f07c450/go.mod h1:ilimTqwHSBjmvKeYA/yayDBZvzf/CX4Pwa9Qbhekzok=
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c h1:kMFnB0vCcX7IL/m9Y5LO+KQYv+t1CQOiFe6+SV2J7bE=
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0=
github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package pagerduty

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

func TestAccPagerDutyUserHandoffNotificationRule_import(t *testing.T) {
userName := fmt.Sprintf("tf-%s", acctest.RandString(5))
contactMethodType := "phone_contact_method"
handoffType := "both"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories(),
CheckDestroy: testAccCheckPagerDutyUserHandoffNotificationRuleDestroy,
Steps: []resource.TestStep{
{
Config: testAccCheckPagerDutyUserHandoffNotificationRuleConfig(userName, contactMethodType, handoffType),
},
{
ResourceName: "pagerduty_user_handoff_notification_rule.foo",
ImportStateIdFunc: testAccCheckPagerDutyUserHandoffNotificationRuleID,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func testAccCheckPagerDutyUserHandoffNotificationRuleID(s *terraform.State) (string, error) {
return fmt.Sprintf("%v.%v", s.RootModule().Resources["pagerduty_user.foo"].Primary.ID, s.RootModule().Resources["pagerduty_user_handoff_notification_rule.foo"].Primary.ID), nil
}
1 change: 1 addition & 0 deletions pagerdutyplugin/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (p *Provider) Resources(ctx context.Context) [](func() resource.Resource) {
func() resource.Resource { return &resourceExtension{} },
func() resource.Resource { return &resourceTagAssignment{} },
func() resource.Resource { return &resourceTag{} },
func() resource.Resource { return &resourceUserHandoffNotificationRule{} },
}
}

Expand Down
Loading

0 comments on commit a90d94f

Please sign in to comment.