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

Cannot delete team with existing Schedules association(s) #358

Closed
m1n9o opened this issue Jul 20, 2021 · 7 comments
Closed

Cannot delete team with existing Schedules association(s) #358

m1n9o opened this issue Jul 20, 2021 · 7 comments

Comments

@m1n9o
Copy link

m1n9o commented Jul 20, 2021

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:

  1. terraform apply
@NargiT
Copy link
Contributor

NargiT commented Aug 2, 2021

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.

@m1n9o
Copy link
Author

m1n9o commented Aug 5, 2021

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.

@edobry
Copy link

edobry commented Sep 7, 2021

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!

@NargiT
Copy link
Contributor

NargiT commented Oct 13, 2021

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.

@imjaroiswebdev
Copy link
Contributor

@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 ✌🏽

@drastawi
Copy link
Contributor

drastawi commented Sep 6, 2022

@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.

@NargiT
Copy link
Contributor

NargiT commented Sep 30, 2022

Great I will start to include Team's ownership now in our production version !

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

No branches or pull requests

5 participants