Skip to content

Commit eea415c

Browse files
committed
Fix tests regarding changes in create_incidents
1 parent d9fa9ad commit eea415c

File tree

3 files changed

+51
-59
lines changed

3 files changed

+51
-59
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
IMPROVEMENTS:
44

55
* `resource/resource_pagerduty_service`: Remove default value and enable diff suppression to account for planned end-of-life of create_incidents option.
6-
* `website/docs/r/service.html.markdown`: Add deprecated information and knowledge base reference for further details.
76

87
## 3.9.0 (Feb 26, 2024)
98

pagerduty/data_source_pagerduty_service_test.go

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ func testAccDataSourcePagerDutyService(src, n string) resource.TestCheckFunc {
101101
func testAccDataSourcePagerDutyServiceConfig(username, email, service, escalationPolicy, teamname string) string {
102102
return fmt.Sprintf(`
103103
resource "pagerduty_team" "team_one" {
104-
name = "%s"
105-
description = "team_one"
104+
name = "%s"
105+
description = "team_one"
106106
}
107107
108108
resource "pagerduty_user" "test" {
@@ -111,24 +111,23 @@ resource "pagerduty_user" "test" {
111111
}
112112
113113
resource "pagerduty_team_membership" "team_membership_one" {
114-
team_id = pagerduty_team.team_one.id
115-
user_id = pagerduty_user.test.id
114+
team_id = pagerduty_team.team_one.id
115+
user_id = pagerduty_user.test.id
116116
}
117117
118118
resource "pagerduty_escalation_policy" "no_team_ep" {
119-
name = "no_team_ep"
120-
num_loops = 2
121-
rule {
122-
escalation_delay_in_minutes = 10
123-
target {
124-
type = "user_reference"
125-
id = pagerduty_user.test.id
126-
}
127-
}
119+
name = "no_team_ep"
120+
num_loops = 2
121+
rule {
122+
escalation_delay_in_minutes = 10
123+
target {
124+
type = "user_reference"
125+
id = pagerduty_user.test.id
126+
}
128127
}
128+
}
129129
130130
resource "pagerduty_escalation_policy" "one_team_ep" {
131-
132131
depends_on = [pagerduty_team_membership.team_membership_one]
133132
name = "%s"
134133
num_loops = 2
@@ -143,24 +142,21 @@ resource "pagerduty_escalation_policy" "one_team_ep" {
143142
}
144143
145144
resource "pagerduty_service" "no_team_service" {
146-
name = "no_team_service"
147-
auto_resolve_timeout = 14400
148-
acknowledgement_timeout = 600
149-
escalation_policy = pagerduty_escalation_policy.no_team_ep.id
150-
alert_creation = "create_incidents"
145+
name = "no_team_service"
146+
auto_resolve_timeout = 14400
147+
acknowledgement_timeout = 600
148+
escalation_policy = pagerduty_escalation_policy.no_team_ep.id
151149
}
152150
153-
154151
resource "pagerduty_service" "one_team_service" {
155152
name = "%s"
156153
auto_resolve_timeout = 14400
157154
acknowledgement_timeout = 600
158155
escalation_policy = pagerduty_escalation_policy.one_team_ep.id
159-
alert_creation = "create_incidents"
160156
}
161157
162158
data "pagerduty_service" "no_team_service" {
163-
name = pagerduty_service.no_team_service.name
159+
name = pagerduty_service.no_team_service.name
164160
}
165161
166162
data "pagerduty_service" "one_team_service" {

pagerduty/resource_pagerduty_service_test.go

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func TestAccPagerDutyService_Basic(t *testing.T) {
7373
resource.TestCheckResourceAttr(
7474
"pagerduty_service.foo", "acknowledgement_timeout", "1800"),
7575
resource.TestCheckResourceAttr(
76-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
76+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
7777
resource.TestCheckNoResourceAttr(
7878
"pagerduty_service.foo", "alert_grouping"),
7979
resource.TestCheckResourceAttr(
@@ -103,7 +103,7 @@ func TestAccPagerDutyService_Basic(t *testing.T) {
103103
resource.TestCheckResourceAttr(
104104
"pagerduty_service.foo", "acknowledgement_timeout", "3600"),
105105
resource.TestCheckResourceAttr(
106-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
106+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
107107
resource.TestCheckResourceAttr(
108108
"pagerduty_service.foo", "incident_urgency_rule.#", "1"),
109109
resource.TestCheckResourceAttr(
@@ -775,7 +775,7 @@ func TestAccPagerDutyService_BasicWithIncidentUrgencyRules(t *testing.T) {
775775
resource.TestCheckResourceAttr(
776776
"pagerduty_service.foo", "acknowledgement_timeout", "1800"),
777777
resource.TestCheckResourceAttr(
778-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
778+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
779779
resource.TestCheckResourceAttr(
780780
"pagerduty_service.foo", "incident_urgency_rule.#", "1"),
781781
resource.TestCheckResourceAttr(
@@ -843,7 +843,7 @@ func TestAccPagerDutyService_BasicWithIncidentUrgencyRules(t *testing.T) {
843843
resource.TestCheckResourceAttr(
844844
"pagerduty_service.foo", "acknowledgement_timeout", "1800"),
845845
resource.TestCheckResourceAttr(
846-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
846+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
847847
resource.TestCheckResourceAttr(
848848
"pagerduty_service.foo", "incident_urgency_rule.#", "1"),
849849
resource.TestCheckResourceAttr(
@@ -897,7 +897,7 @@ func TestAccPagerDutyService_BasicWithIncidentUrgencyRules(t *testing.T) {
897897
resource.TestCheckResourceAttr(
898898
"pagerduty_service.foo", "acknowledgement_timeout", "3600"),
899899
resource.TestCheckResourceAttr(
900-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
900+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
901901
resource.TestCheckResourceAttr(
902902
"pagerduty_service.foo", "incident_urgency_rule.#", "1"),
903903
resource.TestCheckResourceAttr(
@@ -977,7 +977,7 @@ func TestAccPagerDutyService_FromBasicToCustomIncidentUrgencyRules(t *testing.T)
977977
resource.TestCheckResourceAttr(
978978
"pagerduty_service.foo", "acknowledgement_timeout", "1800"),
979979
resource.TestCheckResourceAttr(
980-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
980+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
981981
resource.TestCheckResourceAttr(
982982
"pagerduty_service.foo", "incident_urgency_rule.#", "1"),
983983
resource.TestCheckResourceAttr(
@@ -999,7 +999,7 @@ func TestAccPagerDutyService_FromBasicToCustomIncidentUrgencyRules(t *testing.T)
999999
resource.TestCheckResourceAttr(
10001000
"pagerduty_service.foo", "acknowledgement_timeout", "3600"),
10011001
resource.TestCheckResourceAttr(
1002-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
1002+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
10031003
resource.TestCheckResourceAttr(
10041004
"pagerduty_service.foo", "incident_urgency_rule.#", "1"),
10051005
resource.TestCheckResourceAttr(
@@ -1120,7 +1120,7 @@ func TestAccPagerDutyService_ResponsePlay(t *testing.T) {
11201120
resource.TestCheckResourceAttr(
11211121
"pagerduty_service.foo", "acknowledgement_timeout", "1800"),
11221122
resource.TestCheckResourceAttr(
1123-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
1123+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
11241124
resource.TestCheckNoResourceAttr(
11251125
"pagerduty_service.foo", "alert_grouping"),
11261126
resource.TestCheckResourceAttr(
@@ -1160,7 +1160,7 @@ func TestAccPagerDutyService_ResponsePlay(t *testing.T) {
11601160
resource.TestCheckResourceAttr(
11611161
"pagerduty_service.foo", "acknowledgement_timeout", "1800"),
11621162
resource.TestCheckResourceAttr(
1163-
"pagerduty_service.foo", "alert_creation", "create_incidents"),
1163+
"pagerduty_service.foo", "alert_creation", "create_alerts_and_incidents"),
11641164
resource.TestCheckNoResourceAttr(
11651165
"pagerduty_service.foo", "alert_grouping"),
11661166
resource.TestCheckResourceAttr(
@@ -1308,7 +1308,6 @@ resource "pagerduty_service" "foo" {
13081308
auto_resolve_timeout = 1800
13091309
acknowledgement_timeout = 1800
13101310
escalation_policy = pagerduty_escalation_policy.foo.id
1311-
alert_creation = "create_incidents"
13121311
}
13131312
`, username, email, escalationPolicy, service)
13141313
}
@@ -1617,11 +1616,11 @@ resource "pagerduty_service" "foo" {
16171616
escalation_policy = pagerduty_escalation_policy.foo.id
16181617
alert_creation = "create_alerts_and_incidents"
16191618
alert_grouping_parameters {
1620-
type = "time"
1621-
config {
1622-
timeout = 0
1623-
}
1624-
}
1619+
type = "time"
1620+
config {
1621+
timeout = 0
1622+
}
1623+
}
16251624
}
16261625
`, username, email, escalationPolicy, service)
16271626
}
@@ -1695,12 +1694,12 @@ resource "pagerduty_service" "foo" {
16951694
escalation_policy = pagerduty_escalation_policy.foo.id
16961695
alert_creation = "create_alerts_and_incidents"
16971696
alert_grouping_parameters {
1698-
type = "intelligent"
1699-
config {
1700-
fields = null
1701-
timeout = 0
1702-
}
1703-
}
1697+
type = "intelligent"
1698+
config {
1699+
fields = null
1700+
timeout = 0
1701+
}
1702+
}
17041703
}
17051704
`, username, email, escalationPolicy, service)
17061705
}
@@ -1737,9 +1736,9 @@ resource "pagerduty_service" "foo" {
17371736
escalation_policy = pagerduty_escalation_policy.foo.id
17381737
alert_creation = "create_alerts_and_incidents"
17391738
alert_grouping_parameters {
1740-
type = "intelligent"
1741-
config {}
1742-
}
1739+
type = "intelligent"
1740+
config {}
1741+
}
17431742
}
17441743
`, username, email, escalationPolicy, service)
17451744
}
@@ -1776,8 +1775,8 @@ resource "pagerduty_service" "foo" {
17761775
escalation_policy = pagerduty_escalation_policy.foo.id
17771776
alert_creation = "create_alerts_and_incidents"
17781777
alert_grouping_parameters {
1779-
type = "intelligent"
1780-
}
1778+
type = "intelligent"
1779+
}
17811780
}
17821781
`, username, email, escalationPolicy, service)
17831782
}
@@ -1814,9 +1813,9 @@ resource "pagerduty_service" "foo" {
18141813
escalation_policy = pagerduty_escalation_policy.foo.id
18151814
alert_creation = "create_alerts_and_incidents"
18161815
alert_grouping_parameters {
1817-
type = null
1818-
config {}
1819-
}
1816+
type = null
1817+
config {}
1818+
}
18201819
}
18211820
`, username, email, escalationPolicy, service)
18221821
}
@@ -1853,9 +1852,9 @@ resource "pagerduty_service" "foo" {
18531852
escalation_policy = pagerduty_escalation_policy.foo.id
18541853
alert_creation = "create_alerts_and_incidents"
18551854
auto_pause_notifications_parameters {
1856-
enabled = true
1855+
enabled = true
18571856
timeout = 300
1858-
}
1857+
}
18591858
}
18601859
`, username, email, escalationPolicy, service)
18611860
}
@@ -1892,9 +1891,9 @@ resource "pagerduty_service" "foo" {
18921891
escalation_policy = pagerduty_escalation_policy.foo.id
18931892
alert_creation = "create_alerts_and_incidents"
18941893
auto_pause_notifications_parameters {
1895-
enabled = false
1896-
timeout = null
1897-
}
1894+
enabled = false
1895+
timeout = null
1896+
}
18981897
}
18991898
`, username, email, escalationPolicy, service)
19001899
}
@@ -2353,7 +2352,6 @@ resource "pagerduty_service" "foo" {
23532352
acknowledgement_timeout = 1800
23542353
escalation_policy = pagerduty_escalation_policy.foo.id
23552354
response_play = pagerduty_response_play.foo.id
2356-
alert_creation = "create_incidents"
23572355
}
23582356
`, username, email, escalationPolicy, responsePlay, service)
23592357
}
@@ -2406,7 +2404,6 @@ resource "pagerduty_service" "foo" {
24062404
acknowledgement_timeout = 1800
24072405
escalation_policy = pagerduty_escalation_policy.foo.id
24082406
response_play = null
2409-
alert_creation = "create_incidents"
24102407
}
24112408
`, username, email, escalationPolicy, responsePlay, service)
24122409
}

0 commit comments

Comments
 (0)