Skip to content

[BUG]: Destroy of github_membership fails if the invitation in failed state #2693

@cfromm1911

Description

@cfromm1911

Expected Behavior

By documentation, destroy of github_membership should cancel the invitation or remove the user. This should included Failed Invitations as well.

Actual Behavior

Destroy of github_membership only cancels active invitations. Destroy on a github_membership in a state of failed invitation causes Github API 404 and failure of apply.

Terraform will perform the following actions:

  # github_membership.all_org_members["testuser"] will be destroyed
  # (because key ["testuser"] is not in for_each map)
  - resource "github_membership" "all_org_members" {
      - downgrade_on_destroy = false -> null
      - etag                 = "W/\"74a1af95e5838e42b9d9cb2fd68ac6sdfsdf52cfc89b36179358c986c29614ab6\"" -> null
      - id                   = "repo:testuser" -> null
      - role                 = "member" -> null
      - username             = "testuser" -> null
    }

  # github_team_membership.all_org_members["testuser"] will be destroyed
  # (because key ["testuser"] is not in for_each map)
  - resource "github_team_membership" "all_org_members" {
      - etag     = "W/\"b5e8cb74d2ac42b00decd0dsdfsdf6124eac975bdf1562308f720c4716c377004\"" -> null
      - id       = "13037747:testuser" -> null
      - role     = "member" -> null
      - team_id  = "13037747" -> null
      - username = "testuser" -> null
    }

Plan: 0 to add, 0 to change, 2 to destroy.
github_team_membership.all_org_members["testuser"]: Destroying... [id=13037747:testuser]
github_team_membership.all_org_members["testuser"]: Destruction complete after 1s
github_membership.all_org_members["testuser"]: Destroying... [id=repo:testuser]
╷
│ Error: DELETE https://api.github.com/orgs/repo/memberships/testuser: 404 Cannot find testuser []

│ 
│ 
╵
Error: Terraform exited with code 1.
Error: Process completed with exit code 1.

Terraform Version

  • Installed integrations/github v6.6.0 (signed by a HashiCorp partner, key ID 38027F80D7FD5FB2)

Affected Resource(s)

  • github_membership

Terraform Configuration Files

Steps to Reproduce

No response

Debug Output

Panic Output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    ✅ Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions