PagerDuty / terraform-provider-pagerduty

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

Unable to define time_window values > 1h #849

Closed JelleSmet-TomTom closed 3 weeks ago

JelleSmet-TomTom commented 2 months ago

Hi there,

Terraform Version

All versions. This is a provider error.

Affected Resource(s)

Terraform Configuration Files

resource "pagerduty_service" "service" {
  name                    = "Demo"
  description             = "Description"
  escalation_policy       = "abc"
  alert_creation          = "create_alerts_and_incidents"
  auto_resolve_timeout    = "null"
  acknowledgement_timeout = "null"
  alert_grouping_parameters {
    type = "content_based"
    config {
      aggregate   = "any"
      fields      = ["custom_details.business_service"]
      time_window = "86400"
    }
  }
}

Debug Output

n/a

Panic Output

n/a

Expected Behavior

The validation happening here should also allow for value 86400. The PD api documentation does not mention this. The UI allows this (important) value to be set:

image

When setting this value through the UI and then doing a GET on the service resource we can see the value to be 86400:

... snip ...
    "alert_grouping_parameters": {
      "type": "content_based",
      "config": {
        "fields": [
          "custom_details.some_field"
        ],
        "aggregate": "any",
        "time_window": 86400,
        "recommended_time_window": 300
      }
    },
... snip ...

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

n/a

References

n/a

imjaroiswebdev commented 1 month ago

Hi @JelleSmet-TomTom, this is the expected functionality from our API, due the officially supported value for the setting pagerduty_service.alert_grouping_parameters.0.config.0.time_window through our REST API is >= 300 and <= 3600.

Screenshot 2024-05-29 at 2 47 12 PM

Therefore, being that the PagerDuty Terraform provider is an interface to interact with our REST APIs, then the time_window attribute accepts the supported input range.

imjaroiswebdev commented 3 weeks ago

I'm reopening this issue because of https://github.com/PagerDuty/terraform-provider-pagerduty/pull/876#issuecomment-2168257348.