Closed dkarl-wgs closed 1 month ago
Any updates on this?
Currently, any change on a service with alert_grouping_parameters.type = content_based
leads to an API Error. So we're not able to update our services (even a dot/comma/whatever changed in the title or description would fail when doing a terraform apply)
fyi @imjaroiswebdev, @cjgajard
I do confirm this error.
Payload generated by terraform provider is wrong (I tried with 3.6.0 and 3.12.0)
generated
{
"service": {
"acknowledgement_timeout": null,
"alert_creation": "create_alerts_and_incidents",
"alert_grouping": "rules",
"alert_grouping_parameters": {
"type": "content_based",
"config": {
"timeout": 0,
"time_window": 86400,
"aggregate": "all",
"fields": [
"summary"
]
}
},
"auto_pause_notifications_parameters": {
"enabled": false,
"timeout": null
},
"auto_resolve_timeout": 14400,
"description": "⚡ by Terraform",
"escalation_policy": {
"id": "P3UVY7I",
"type": "escalation_policy_reference"
},
"response_play": null,
"incident_urgency_rule": {
"type": "constant",
"urgency": "severity_based"
},
"name": "foo|bar|prod"
}
}
receive : 400
{
"error": {
"message": "Invalid Input Provided",
"code": 2001,
"errors": [
"Internal Server Error"
]
}
}
Expected or working payload
{
"service": {
"id": "PWJOVNW",
"name": "foo|bar|prod",
"description": "⚡ by Terraform",
"created_at": "2023-10-10T12:10:39+02:00",
"updated_at": "2024-04-08T12:37:01+02:00",
"status": "active",
"teams": [
{
"id": "PDQZ8SJ",
"type": "team_reference",
"summary": "squad.marketdatanews",
"self": "https://api.eu.pagerduty.com/teams/PDQZ8SJ",
"html_url": "https://swissquote.eu.pagerduty.com/teams/PDQZ8SJ"
}
],
"alert_creation": "create_alerts_and_incidents",
"addons": [],
"scheduled_actions": [],
"support_hours": null,
"last_incident_timestamp": null,
"escalation_policy": {
"id": "P3UVY7I",
"type": "escalation_policy_reference",
"summary": "squad.marketdatanews and it.ops and apr.nightshift contract",
"self": "https://api.eu.pagerduty.com/escalation_policies/P3UVY7I",
"html_url": "https://swissquote.eu.pagerduty.com/escalation_policies/P3UVY7I"
},
"incident_urgency_rule": {
"type": "constant",
"urgency": "severity_based"
},
"acknowledgement_timeout": null,
"auto_resolve_timeout": 14400,
"alert_grouping": "rules",
"alert_grouping_timeout": null,
"alert_grouping_parameters": {
"type": "content_based",
"config": {
"fields": [
"summary"
],
"aggregate": "all",
"time_window": 86400,
"recommended_time_window": 300
},
"is_global_configuration": false
},
"alert_grouping_rules": {
"fields": [
"summary"
],
"aggregate": "all",
"time_window": 86400,
"recommended_time_window": 300
},
"integrations": [],
"response_play": null,
"type": "service",
"summary": "foo|bar|prod",
"self": "https://api.eu.pagerduty.com/services/PWJOVNW",
"html_url": "https://swissquote.eu.pagerduty.com/service-directory/PWJOVNW"
}
}
I was able to reproduce this using https://developer.pagerduty.com/api-reference.
Be aware, this is a blocker on our side. we have 100 services that cannot be updated because of this server side bug.
I can confirm that this issue has been fixed with v3.12.1 -> https://github.com/PagerDuty/terraform-provider-pagerduty/releases/tag/v3.12.1
(https://github.com/PagerDuty/terraform-provider-pagerduty/pull/871)
Thank you @cjgajard!
Terraform Version
Provider Version
Affected Resource(s)
Terraform Configuration Files
Debug Output
Expected Behavior
When updating the alert_grouping settings of a service in Terraform, it should not result in an API error.
creating a service works just fine:
Actual Behavior
When changing a property in
alert_grouping_parameters.config.fields
for example (or another one likeaggregate
,..), 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.timeout
property when using "type=content_based", but the provider actually always adds this property, independently from thetype
attribute.Even though when setting
alert_grouping_parameters.config.timeout
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, because a few weeks/months 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.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
pagerduty_service.test_service.alert_grouping_parameters.config.fields
property (add, change or remove an item)terraform apply