Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSGI-2172 ] Support for Intelligent Time Window to Alert Grouping Parameters #773

Merged

Conversation

imjaroiswebdev
Copy link
Contributor

@imjaroiswebdev imjaroiswebdev commented Nov 21, 2023

Add support for Intelligent Time Window to Service Alert Grouping Parameters configuration, allowing from this point to do the following...

resource "pagerduty_service" "example" {
  name                    = "My Web App"
  auto_resolve_timeout    = 14400
  acknowledgement_timeout = 600
  escalation_policy       = pagerduty_escalation_policy.foo.id
  alert_creation          = "create_alerts_and_incidents"

  auto_pause_notifications_parameters {
    enabled = true
    timeout = 300
  }
  alert_grouping_parameters {
    type = "intelligent"
    config {
      time_window = 300 # 👈 New attribute introduced
    }
  }
}

Additionally, validation for Alert Grouping Parameters configuration options was introduced, producing the following output based on the type of alert grouping set...

│ Error: Alert grouping parameters configuration of type "intelligent" only supports setting the optional attribute "time_window"
│ Error: Alert grouping parameters configuration of type "content_based" only supports setting "aggregate" and "fields" attributes
│
│ Error: Alert grouping parameters configuration of type "time" only supports setting "timeout" attribute
│

New test cases introduced...

$ make testacc TESTARGS="-run TestAccPagerDutyService_AlertContentGroupingIntelligentTimeWindow"
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test $(go list ./... |grep -v 'vendor') -v -run TestAccPagerDutyService_AlertContentGroupingIntelligentTimeWindow -timeout 120m
?       github.com/terraform-providers/terraform-provider-pagerduty     [no test files]
=== RUN   TestAccPagerDutyService_AlertContentGroupingIntelligentTimeWindow
--- PASS: TestAccPagerDutyService_AlertContentGroupingIntelligentTimeWindow (18.30s)
PASS
ok      github.com/terraform-providers/terraform-provider-pagerduty/pagerduty   18.822s

Depends on heimweh/go-pagerduty#142

@imjaroiswebdev imjaroiswebdev force-pushed the support-intelligent-time-window branch from 2a7ef54 to 8f9a161 Compare November 25, 2023 01:08
@imjaroiswebdev imjaroiswebdev marked this pull request as ready for review November 25, 2023 01:09
@imjaroiswebdev imjaroiswebdev merged commit 67bec0a into PagerDuty:master Nov 25, 2023
1 check passed
@imjaroiswebdev imjaroiswebdev deleted the support-intelligent-time-window branch November 28, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant