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
team_membership fails to support the the following team membership deletion scenario:
user1 is a member of team1 and team2
team1 is associated to escalation_policy1; team2 is associated to escalation_policy2
user1's team1 membership is removed from Terraform HCL
As a result, the following error occurs:
pagerduty_team_membership.redacted: Still destroying... [id=REDACTED:REDACTED, 2m0s elapsed]
| │ Error: PUT API call to https://api.pagerduty.com/teams/team1/escalation_policies/escalation_policy2 failed 400 Bad Request. Code: 2001, Errors: <nil>, Message: Escalation Policy has already been taken; Error while trying to associate back team "team1" to Escalation Policy "escalation_policy2". Resource succesfully deleted, but some team association couldn't be completed, so you need to run "terraform plan -refresh-only" and again "terraform apply/destroy" in order to remediate the drift
In addition to the apply failure, also note...
user1's team1 membership is not actually successfully deleted in my case (I haven't quite gotten to the bottom of this, yet)
terraform plan -refresh-only does not resolve the issue, despite the error message suggesting it does (perhaps because user1's team membership is not deleted in my case)
"successfully" is misspelled in the error message ;)
Why?
IIUC, I believe this is because, at least at the time of writing (HEAD master commit 149d755), in order to delete a team membership...
resource"pagerduty_team""team1" {
name="team1"
}
resource"pagerduty_team""team2" {
name="team2"
}
# NOTE: The original TF configuration featured user1 as a member of team1.# Now, we'd like to remove that membership.# resource "pagerduty_team_membership" "user1_team1" {# user_id = pagerduty_user.user1.id# team_id = pagerduty_team.team1.id# }resource"pagerduty_team_membership""user1_team2" {
user_id=pagerduty_user.user1.idteam_id=pagerduty_team.team2.id
}
resource"pagerduty_escalation_policy""team1" {
name=pagerduty_team.team1.nameteams=[pagerduty_team.team1.id]
...
}
resource"pagerduty_escalation_policy""team2" {
name=pagerduty_team.team2.nameteams=[pagerduty_team.team2.id]
...
}
Expected Behavior
user1's team1 membership can be deleted.
Actual Behavior
The following error occurs:
pagerduty_team_membership.redacted: Still destroying... [id=REDACTED:REDACTED, 2m0s elapsed]
| │ Error: PUT API call to https://api.pagerduty.com/teams/REDACTED_TEAM/escalation_policies/REDACTED_EP failed 400 Bad Request. Code: 2001, Errors: <nil>, Message: Escalation Policy has already been taken; Error while trying to associate back team "REDACTED_TEAM" to Escalation Policy "REDACTED_EP". Resource succesfully deleted, but some team association couldn't be completed, so you need to run "terraform plan -refresh-only" and again "terraform apply/destroy" in order to remediate the drift
| │
| │
Potential fix implementation?
Ideally ideally, team membership management would not require the out-of-band disassociating/re-associating of escalation policies to teams. However, perhaps a stop gap solution could be for the provider to only disassociate and re-associate the escalation policies associated to the team whose membership is being altered (and not all the escalation policies associated to the user, which may include other teams' escalation policies).
The text was updated successfully, but these errors were encountered:
team_membership
fails to support the the following team membership deletion scenario:user1
is a member ofteam1
andteam2
team1
is associated toescalation_policy1
;team2
is associated toescalation_policy2
user1
'steam1
membership is removed from Terraform HCLAs a result, the following error occurs:
In addition to the
apply
failure, also note...user1
'steam1
membership is not actually successfully deleted in my case (I haven't quite gotten to the bottom of this, yet)terraform plan -refresh-only
does not resolve the issue, despite the error message suggesting it does (perhaps becauseuser1
'steam
membership is not deleted in my case)Why?
IIUC, I believe this is because, at least at the time of writing (HEAD
master
commit 149d755), in order to delete a team membership...user1
(escalation_policy1
,escalation_policy2
)escalation_policy1
andescalation_policy2
fromteam1
user1
'steam1
membershipescalation_policy1
andescalation_policy2
toteam1
; this fails becauseescalation_policy2
was never associated withteam1
; it's associated withteam2
, whereuser1
is also a memberTerraform Version
1+
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
user1
'steam1
membership can be deleted.Actual Behavior
The following error occurs:
Potential fix implementation?
Ideally ideally, team membership management would not require the out-of-band disassociating/re-associating of escalation policies to teams. However, perhaps a stop gap solution could be for the provider to only disassociate and re-associate the escalation policies associated to the team whose membership is being altered (and not all the escalation policies associated to the user, which may include other teams' escalation policies).
The text was updated successfully, but these errors were encountered: