Closed ppiotrlach closed 2 weeks ago
I have the same problem.
Looks like API request expected by OG API has changed. Please help!
Talking with the support currently. According to https://docs.opsgenie.com/docs/service-incident-rules-api
expected body is
curl -X POST "https://api.opsgenie.com/v1/services/<OBFUSCATED>/incident-rules" \
-H "Authorization: GenieKey <OBFUSCATED>" \
-H "Content-Type: application/json" \
-d '{
"conditionMatchType": "match-all-conditions",
"conditions": [{
"expectedValue": "Incident",
"operation": "contains",
"not": false,
"field": "message"
}],
"incidentProperties": {
"message": "Incident Message",
"description": "Incident Description",
"tags": ["Tag1", "Tag2"],
"priority": "P4",
"stakeholderProperties": {
"enable": true,
"message": "Stakeholder Message",
"description": "Stakeholder Description"
}
}
}'
However this returns 422. Support asked to add one layer of abstraction in the payload and this below then returns 200 but we need to work on this to reflect that change to the go file for TF module:
curl -X POST "https://api.opsgenie.com/v1/services/<OBFUSCATED>/incident-rules" \
-H "Authorization: GenieKey <OBFUSCATED>" \
-H "Content-Type: application/json" \
-d '{
"incidentRule": { <<<--- This line added
"conditionMatchType": "match-all-conditions",
"conditions": [{
"expectedValue": "Incident",
"operation": "contains",
"not": false,
"field": "message"
}],
"incidentProperties": {
"message": "Incident Message",
"description": "Incident Description",
"tags": ["Tag1", "Tag2"],
"priority": "P4",
"stakeholderProperties": {
"enable": true,
"message": "Stakeholder Message",
"description": "Stakeholder Description"
}
}
} <<<--- ends here
}'
Maybe Solution would be something similar? https://github.com/opsgenie/terraform-provider-opsgenie/pull/455
This has been accepted as a bug by Atlassian after P1 for a customer has been reported by us, so perhaps fixing it here is not correct, as instead it may be fixed by Atlassian: https://jira.atlassian.com/browse/OPSGENIE-2359
This has been accepted as a bug by Atlassian after P1 for a customer has been reported by us, so perhaps fixing it here is not correct, as instead it may be fixed by Atlassian: https://jira.atlassian.com/browse/OPSGENIE-2359
Whatever works for them, sir. I just tried to help but still, they have the full context of what has happened and how to mitigate it. Proposal here maybe not the cleanest and long term solution, more on setting fire off. :)
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
New incident rule should be created.
Actual Behavior
I also have tried without some of optional fields but result was all the same.
Additional notes
I was updating multiple Opsgenie repositories across our organization with mentioned changes. MRs which were merged previous week were applied without issues, afterwards we started experiencing this issue. Seems like something have changed in Opsgenie API during this period?