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

Github Team Membership fails on terraform destroy #329

Closed
ghost opened this issue Jan 17, 2020 · 2 comments
Closed

Github Team Membership fails on terraform destroy #329

ghost opened this issue Jan 17, 2020 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 17, 2020

This issue was originally opened by @kahootali as hashicorp/terraform#23883. It was migrated here as a result of the provider split. The original body of the issue is below.


I am following https://www.terraform.io/docs/providers/github/r/team_membership.html to create github user and make it a member of Github team. When I apply it, it successfully adds user and adds it in team but Issue is if I want to remove a user from the organization and remove its membership, it causes an error.

Terraform Version

I have tested on terraform 0.11.11 and 0.12.7


### Terraform Configuration Files

```hcl
resource "github_team" "developers" {
  name        = "dev"
  description = "Dev team"
}
resource "github_membership" "user" {
  username = "kahootali"
  role     = "member"
}
resource "github_team_membership" "team_member" {
  team_id = "${github_team.developers.id}"
  username = "kahootali"
  role     = "member"
}
...

Debug Output

Expected Behavior

The membership should have removed first and then the user from the organization.

Actual Behavior

It fails giving error github_team_membership.user_team: Unexpected ID format (""), expected numerical ID. strconv.ParseInt: parsing "": invalid syntax

Steps to Reproduce

terraform init
terraform apply

Now remove the github_membership.user resource and github_team_membership.team_member resource and then apply again.

terraform apply

It will ask to delete the user and its membership, which will then fail

@steakfest
Copy link

Duplicate of #323 and #324

@radeksimko
Copy link
Contributor

Thank you @steakfest for noticing, you are right. I'm going to close this as a duplicate of #323

I just merged a PR which fixes the bug and we will release it soon.

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

2 participants