@@ -684,6 +684,38 @@ func TestAccPagerDutyService_AlertContentGroupingIntelligentTimeWindow(t *testin
684
684
})
685
685
}
686
686
687
+ func TestAccPagerDutyService_Delete24HAlertGrouping (t * testing.T ) {
688
+ group := fmt .Sprintf ("tf-%s" , acctest .RandString (5 ))
689
+ email := fmt .
Sprintf (
"%[email protected] " ,
group )
690
+ service := fmt .Sprintf ("tf-%s" , acctest .RandString (5 ))
691
+
692
+ resource .Test (t , resource.TestCase {
693
+ PreCheck : func () { testAccPreCheck (t ) },
694
+ Providers : testAccProviders ,
695
+ CheckDestroy : testAccCheckPagerDutyServiceDestroy ,
696
+ Steps : []resource.TestStep {
697
+ {
698
+ Config : testAccCheckPagerDutyServiceConfigWithAlertContentGrouping24H (group , email , group , service ),
699
+ Check : resource .ComposeTestCheckFunc (
700
+ testAccCheckPagerDutyServiceExists ("pagerduty_service.foo" ),
701
+ resource .TestCheckResourceAttr ("pagerduty_service.foo" , "name" , service ),
702
+ resource .TestCheckResourceAttr ("pagerduty_service.foo" , "alert_grouping_parameters.0.type" , "content_based" ),
703
+ resource .TestCheckResourceAttr ("pagerduty_service.foo" , "alert_grouping_parameters.0.config.0.time_window" , "86400" ),
704
+ ),
705
+ },
706
+ {
707
+ Config : testAccCheckPagerDutyServiceConfigWithAlertContentGrouping24HUpdated (group , email , group , service ),
708
+ Check : resource .ComposeTestCheckFunc (
709
+ testAccCheckPagerDutyServiceExists ("pagerduty_service.foo" ),
710
+ resource .TestCheckResourceAttr ("pagerduty_service.foo" , "name" , service ),
711
+ resource .TestCheckNoResourceAttr ("pagerduty_service.foo" , "alert_grouping_parameters.0.type" ),
712
+ resource .TestCheckNoResourceAttr ("pagerduty_service.foo" , "alert_grouping_parameters.0.config.0.time_window" ),
713
+ ),
714
+ },
715
+ },
716
+ })
717
+ }
718
+
687
719
func TestAccPagerDutyService_AutoPauseNotificationsParameters (t * testing.T ) {
688
720
username := fmt .Sprintf ("tf-%s" , acctest .RandString (5 ))
689
721
email := fmt .
Sprintf (
"%[email protected] " ,
username )
@@ -1444,6 +1476,67 @@ resource "pagerduty_service" "foo" {
1444
1476
` , username , email , escalationPolicy , service )
1445
1477
}
1446
1478
1479
+ func testAccCheckPagerDutyServiceConfigWithAlertContentGrouping24H (username , email , escalationPolicy , service string ) string {
1480
+ return fmt .Sprintf (`
1481
+ resource "pagerduty_user" "foo" {
1482
+ name = "%s"
1483
+ email = "%s"
1484
+ }
1485
+
1486
+ resource "pagerduty_escalation_policy" "foo" {
1487
+ name = "%s"
1488
+ num_loops = 2
1489
+ rule {
1490
+ escalation_delay_in_minutes = 10
1491
+ target {
1492
+ type = "user_reference"
1493
+ id = pagerduty_user.foo.id
1494
+ }
1495
+ }
1496
+ }
1497
+
1498
+ resource "pagerduty_service" "foo" {
1499
+ name = "%s"
1500
+ escalation_policy = pagerduty_escalation_policy.foo.id
1501
+ alert_grouping_parameters {
1502
+ type = "content_based"
1503
+ config {
1504
+ time_window = 86400
1505
+ aggregate = "all"
1506
+ fields = ["custom_details.field1"]
1507
+ }
1508
+ }
1509
+ }` , username , email , escalationPolicy , service )
1510
+ }
1511
+
1512
+ func testAccCheckPagerDutyServiceConfigWithAlertContentGrouping24HUpdated (username , email , escalationPolicy , service string ) string {
1513
+ return fmt .Sprintf (`
1514
+ resource "pagerduty_user" "foo" {
1515
+ name = "%s"
1516
+ email = "%s"
1517
+ }
1518
+
1519
+ resource "pagerduty_escalation_policy" "foo" {
1520
+ name = "%s"
1521
+ num_loops = 2
1522
+ rule {
1523
+ escalation_delay_in_minutes = 10
1524
+ target {
1525
+ type = "user_reference"
1526
+ id = pagerduty_user.foo.id
1527
+ }
1528
+ }
1529
+ }
1530
+
1531
+ resource "pagerduty_service" "foo" {
1532
+ name = "%s"
1533
+ escalation_policy = pagerduty_escalation_policy.foo.id
1534
+ alert_grouping_parameters {
1535
+ type = null
1536
+ }
1537
+ }` , username , email , escalationPolicy , service )
1538
+ }
1539
+
1447
1540
func testAccCheckPagerDutyServiceConfigWithAlertContentGroupingIntelligentTimeWindow (username , email , escalationPolicy , service string ) string {
1448
1541
return fmt .Sprintf (`
1449
1542
resource "pagerduty_user" "foo" {
0 commit comments