You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using Terraform to assign a person to both a pagerduty team and a schedule, Terraform can't remove the user in one run because of an ordering problem. Specifically: TF will first attempt to remove the user from the pagerduty team, which error because they are still in the schedule.. even when removing the user from the schedule was on the list of things to do in the run.
Note that pagerduty_team_membership and pagerduty_schedule have no direct link.. there's an indirect link through pagerduty_escalation_policy. Maybe changing the schedule first would be safer?
Terraform Configuration Files
(disclaimer, I haven't actually run this code. It's a stripped down version I have run though. If it's helpful, please reach out and I'll debug it.)
Team membership and schedule membership removed after TF is run.
Actual Behaviour
Schedule membership is removed, team membership is unchanged there's an error.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
-1. populate the people list with real pagerduty user ids.
0. terraform init
terraform apply
remove one of the users from people
terraform apply
Typically (always?) I get:
Error: DELETE API call to https://api.pagerduty.com/teams/XXXXX/users/XXXXXX 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
This is how the PagerDuty web UI behaves when you try to remove a user from a team that is already associated with an escalation policy. So, if you were were simply trying to remove the team member, this is expected behavior. However, if you're trying to remove the team members while also removing the team from the escalation policy, I'm thinking we should add some retry logic to the team_member deletion process, in case in tries to happen before the team deletion process. Thanks for bringing this up!
When using Terraform to assign a person to both a pagerduty team and a schedule, Terraform can't remove the user in one run because of an ordering problem. Specifically: TF will first attempt to remove the user from the pagerduty team, which error because they are still in the schedule.. even when removing the user from the schedule was on the list of things to do in the run.
Attempted to control destroy behaviour with depends_on failed. I gave when I noticed that it doesn't help (https://www.reddit.com/r/Terraform/comments/cukfbn/control_destroy_order/)
Terraform Version
Affected Resource(s)
Note that
pagerduty_team_membership
andpagerduty_schedule
have no direct link.. there's an indirect link throughpagerduty_escalation_policy
. Maybe changing the schedule first would be safer?Terraform Configuration Files
(disclaimer, I haven't actually run this code. It's a stripped down version I have run though. If it's helpful, please reach out and I'll debug it.)
Debug Output
(available on request)
Expected Behaviour
Team membership and schedule membership removed after TF is run.
Actual Behaviour
Schedule membership is removed, team membership is unchanged there's an error.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
-1. populate the
people
list with real pagerduty user ids.0.
terraform init
terraform apply
people
terraform apply
Typically (always?) I get:
When run a second time, it succeeds.
Important Factoids
Not that I'm aware of.
References
not that I'm aware of. https://github.com/terraform-providers/terraform-provider-pagerduty/issues/66 looks similar, but not the same.
The text was updated successfully, but these errors were encountered: