Closed catalinmares closed 1 year ago
Hi @catalinmares , thanks for the contribution and that detailed explanation. We released a new version and verified that the issue seems to be resolved. I'm closing this issue and I'm kindly asking you to test it with the latest version. If you encounter a problem again feel free to reopen this issue. Gday
Hi there,
I came accross a bug using the opsgenie_escalation Terraform resource. Whenever I try updating the escalation by modifying the Terraform resource in the configuration file and hit apply, I get a forbidden error, complaining that I am not allowed to change the owner team of the escalation policy with the current API key.
Of course, I understand that in order to change the owner team I would need a global Opsgenie API key, not a team-scoped one, like I am currently using. But this is not my use case right now. I am not planning to change the owner team of the escalation policy, I just need to be able to update fields like name or the fields from the rules blocks. Also, in my organisation I am not allowed to used global API keys since it would interfere with the other teams' work.
I noticed that for the update, the PATCH method is used against the Opsgenie API (https://docs.opsgenie.com/docs/escalation-api#update-escalation-partial) and all the fields are optional, allowing you to specify only the fields that you need to update.
Terraform Version
Terraform v1.3.2 on linux_amd64
Affected Resource
opsgenie_escalation
Terraform Configuration Files
Debug Output
https://gist.github.com/catalinmares/3004d4dc4a8d47508a5f6d2692915664#file-opsgenie_escalation_debug-txt
Expected Behavior
With the escalation_policy in the Terraform state having the configuration provided above, when changing the delays, a request to the Opsgenie API should have been made specifying only the fields that changed.
Actual Behavior
Looks like all the fields are sent in the request (more like a PUT instead of a PATCH), making the request fail when a team-scoped API key is used because of the owner_team_id field.
Steps to Reproduce