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

Bug: Creating/updating a service with alert_grouping.type="time" leads to an API error "Invalid Input Provided" #887

Closed
luca-bozzetto-depop opened this issue Jun 19, 2024 · 0 comments · Fixed by #888
Assignees

Comments

@luca-bozzetto-depop
Copy link

Terraform Version

Terraform v1.8.5
on darwin_arm64

Affected Resource(s)

pagerduty_service

Terraform Configuration Files

resource "pagerduty_service" "test_service" {
  name                    = "test-service"
  escalation_policy       = var.escalation_policy

  alert_grouping_parameters {
    type = "time"
    config {
      timeout = 15
    }
  }
}

Debug Output

https://gist.github.com/luca-bozzetto-depop/68ccb43f7d2147db18848755d3898b25

Expected Behavior

Creating or updating the alert_grouping_parameters settings for the type time for service in Terraform, should not result in an API error.

Actual Behavior

When creating or updating a service that uses the alert_grouping_parameters of type time, the TF-apply fails with an API error.
According to the PD-API spec (https://developer.pagerduty.com/api-reference/fbc6e9f4ef8eb-update-a-service), it's not allowed to set the alert_grouping_parameters.config.time_window alert_grouping_parameters.config.aggregate properties when using "type=time", but the provider actually always adds this property, independently from the type attribute.
Even though when setting alert_grouping_parameters.config.time_window to null, it's not omitted in the API-request.

I would assume that this has been introduced by a change/limitation on the PagerDuty-API side, this changelog seems to confirm it because a few days ago we were able to set such a configuration on some of our services (when updating them via Terraform). Today, it doesn't work anymore.

terraform will perform the following actions:

  # pagerduty_service.test_service will be updated in-place
  ~ resource "pagerduty_service" "test_service" {
        id                      = "PHV9J4Z"
        name                    = "test-service"

      ~ alert_grouping_parameters {
          + type = "time"

          + config {
              + timeout = 15
            }
        }

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

pagerduty_service.test_service: Modifying... [id=PHV9J4Z]
╷
│ Error: Error reading: PHV9J4Z: PUT API call to https://api.eu.pagerduty.com/services/PHV9J4Z failed 400 Bad Request. Code: 2001, Errors: [config has invalid fields.], Message: Invalid Input Provided
│ 
│   with pagerduty_service.test_service,
│   on service-test.tf line 1, in resource "pagerduty_service" "test_service":
│    1: resource "pagerduty_service" "test_service" {
│ 

Releasing state lock. This may take a few moments...

Steps to Reproduce

  1. create/update the pagerduty_service.test_service.alert_grouping_parameters.config.timeout property
  2. terraform apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants