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

Support for gracefully destroy pagerduty_team_membership #558

Conversation

imjaroiswebdev
Copy link
Contributor

@imjaroiswebdev imjaroiswebdev commented Aug 17, 2022

Addresses #427 and #534

This change is aimed to solve the recurring issue of getting an error of the kind...

Error: DELETE API call to https://api.pagerduty.com/teams/PEYO30I/users/PH5F8MH failed 400 Bad Request. Code: 2001, Errors: [User cannot be removed as they belong to an escalation policy on this team], Message: Invalid Input Provided

Without this update the API for dissociating an User from a Team currently can't remove it gracefully if the team is already linked to an Escalation Policy. So the solution is to dissociate the Team from the EP, remove the User from the Team and associate back the Team to the EP. Therefore, this change include the calls for following above mentioned flow.

As direct consequence to this change deleting Users and Team Memberships linked with Escalation Policies will be solved too.

Test results...

Screen Shot 2022-08-17 at 18 16 01

@stephanebruckert
Copy link

Using 2.9.3 and still getting User cannot be removed as they belong to an escalation policy on this team:

module.first-last.pagerduty_team_membership.team_memberships["TEAM"]: Still destroying... [id=some-id, 1m50s elapsed]
module.first-last.pagerduty_team_membership.team_memberships["TEAM"]: Still destroying... [id=some-id, 2m0s elapsed]

Error: DELETE API call to https://api.pagerduty.com/teams/team-id/users/user-id failed 400 Bad Request. Code: 2001, Errors: [User cannot be removed as they belong to an escalation policy on this team], Message: Invalid Input Provided

any idea @imjaroiswebdev?

@deniojunior-hotmart
Copy link

Using 2.11.0 and I'm still getting this error

@bschaeffer
Copy link

Same as @deniojunior-hotmart. @imjaroiswebdev is there a way we need to setup our resources so that these things are being deleted correctly? I tried setting a it such that the team_membership depends_on schedule but TF still tries to delete the membership first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants