PagerDuty / terraform-provider-pagerduty

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

Grouping alert for a `time_window` should be allowed whatever the grouping type is. #788

Closed Nikokolas3270 closed 8 months ago

Nikokolas3270 commented 9 months ago

Terraform Version

Affected Resource(s)

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

resource "pagerduty_service" "my_service" {
    ...
    alert_grouping_parameters {
        type = "content_based"
        config {
            aggregate = "all"
            fields = ["custom_details.source_id"]
            time_window = 900
        }
    }
}

Debug Output

Plan: 1 to add, 0 to change, 0 to destroy.
╷
│ Error: Alert grouping parameters configuration attribute "time_window" is only supported by "intelligent" type Alert Grouping
│
│   with module.pagerduty_services.pagerduty_service.services["my_service"],
│   on pagerduty_services/main.tf line 6, in resource "pagerduty_service" "services":
│    6: resource "pagerduty_service" "services" {
│

Expected Behavior

It should be okay to set a time_window even if the type is content_based. Indeed manually tweaking the "Alerts may be grouped if they arrive within a XXX window" setting is possible whatever the alert grouping type is chosen.

Actual Behavior

Setting a time_window is not possible if the type is content_based.

Steps to Reproduce

  1. Create a pagerduty_service with the given alert_grouping_parameters
  2. Run terraform apply

Important Factoids

Issue occurs on all versions providing the time_window setting (version >= 3.2.0)

References

Some other recent issue on the content_based type: https://github.com/PagerDuty/terraform-provider-pagerduty/issues/778

buffyg commented 9 months ago

Fix submitted: https://github.com/PagerDuty/terraform-provider-pagerduty/pull/795

Nikokolas3270 commented 9 months ago

Thanks! I was actually gonna submit the exact same fix :)