terraform-provider-pagerduty
terraform-provider-pagerduty copied to clipboard
Cannot delete team with existing Schedules association(s)
Terraform Version
0.15.5
Affected Resource(s)
Please list the resources as a list, for example:
- team
- schedule
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
The problem is much straightforward. I created a team with escalation policy and services. I removed the escalation policy and services with terraform apply. After that, when I try to remove the team. It says cannot delete team with existing schedules association(s). It's quite annoying if we need to disassociate them manually.
Panic Output
[2021-07-20T08:26:25Z] Error: DELETE API call to https://api.pagerduty.com/teams/P2WMR52 failed 400 Bad Request. Code: 6006, Errors: [Cannot delete team with existing Schedules association(s)], Message: Team has existing associations.
Expected Behavior
It should be able to remove the team.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
-
terraform apply
it's limitation on pager duty. Since the schedule is linked to the team, you cannot delete the team. you need to first delete the schedule then the team.
maybe you can used depends_on
feature so terraform will first delete that perticular schedule before the team.
it's limitation on pager duty. Since the schedule is linked to the team, you cannot delete the team. you need to first delete the schedule then the team.
maybe you can used
depends_on
feature so terraform will first delete that perticular schedule before the team.
Why not just disassociate them so that terraform can destroy it. And keep the schedule at the same time.
Schedule
should not be deleted and re-created that often.
This is also an issue for me, I've tried configuring the depends_on
in a variety of ways but couldn't get it to work. Ended up having to delete manually through the UI; would be great to be able to delete through TF!
What is funny is that you can create a schedule only if a responder is assign to it. but if you delete the user, the schedule still exists and a "shadow user take it's place". Feels like core design issues IMO. This make terraform a bit more tricky to use.
@m1n9o @NargiT @edobry An update for fixing this issue was merged on #561 and It has been released in version v2.6.1 of PagerDuty TF Provider, so updating to the new version hopefully You all would be able to gracefully delete Schedules without getting stuck with into this error. Please if You find any further issues related with this error after updating don't hesitate on reopening this Issue ✌🏽
@imjaroiswebdev there are still two use cases. one will be solved in #564 and one is when the schedule is the only remaining one in an escalation policy.
Great I will start to include Team's ownership now in our production version !