Skip to content

pagerduty_service - updating escalation policy reference fails indicating Message: Product limit exceeded #1025

@indiebrain

Description

@indiebrain

Terraform Version

1.12.1

Provider Version

3.25.2

Description

Changing the escalation policy of a pagerduty_service resource fails indicating that some Message: Product limit exceeded, but applying the same changes via the UI and API calls work just fine. The service, and both escalation policies already exist in PagerDuty; IE this a reassignment of the service's escalation policy reference.

Outstanding questions

Since the updates via the UI and raw API calls work, the "Product limit exceeded" looks like either a misdirection, or a clue that the provider is trying to do something more/different than I'm intuiting from the plan output. Can one get more verbose logs of the API calls (the request body, perhaps?) from the provider?

Terraform Config

resource "pagerduty_service" "production" {
  name = "example-application (Production)"

-  escalation_policy = pagerduty_escalation_policy.current-team.id
+  escalation_policy = pagerduty_escalation_policy.example-team.id

  acknowledgement_timeout = "null"
  alert_creation          = "create_alerts_and_incidents"
  auto_resolve_timeout    = "null"

  incident_urgency_rule {
    type    = "constant"
    urgency = "low"
  }
}

Terraform Plan Output

  # module.example-application.pagerduty_service.production[0] will be updated in-place
  ~ resource "pagerduty_service" "production" {
      ~ escalation_policy       = "${CURRENT_TEAM_ESCALATION_POLICY_ID}" -> "${EXAMPLE_TEAM_ESCALATION_POLICY_ID}"
        id                      = "${EXAMPLE_APPLICATION_SERVICE_ID}"
        name                    = "example-application (Production)"
        # (11 unchanged attributes hidden)

        # (4 unchanged blocks hidden)
    }

Terraform Apply Output

module.example-application.pagerduty_service.production[0]: Modifying... [id=${EXAMPLE_APPLICATION_SERVICE_ID}]
...
Error: Error reading: ${EXAMPLE_APPLICATION_SERVICE_ID}: PUT API call to https://api.pagerduty.com/services/${EXAMPLE_APPLICATION_SERVICE_ID} failed 403 Forbidden. Code: 2019, Errors: [map[error_code:2010 message:Access Denied]], Message: Product limit exceeded

  with module.example-application.pagerduty_service.production[0],
  on modules/application/main.tf line 121, in resource "pagerduty_service" "production":
 121: resource "pagerduty_service" "production" {

Additional Information

Modifying this resource directly via the API changes the Service's escalation policy to the desired state.

$ curl -s --request PUT \
  --url https://api.pagerduty.com/services/${EXAMPLE_APPLICATION_SERVICE_ID} \
  --header 'Accept: application/json' \
  --header "Authorization: Token token=${PAGERDUTY_API_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{
  "service": {
    "escalation_policy": {
      "id": "${EXAMPLE_TEAM_ESCALATION_POLICY_ID}",
      "type": "escalation_policy_reference"
    }
  }
}' | jq .service.escalation_policy

{
  "id": "${EXAMPLE_TEAM_ESCALATION_POLICY_ID}",
  "type": "escalation_policy_reference",
  "summary": "Example Team",
  "self": "https://api.pagerduty.com/escalation_policies/${EXAMPLE_TEAM_ESCALATION_POLICY_ID}",
  "html_url": "https://powerhome.pagerduty.com/escalation_policies/${EXAMPLE_TEAM_ESCALATION_POLICY_ID}"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions