Skip to content

feat: add ability to downgrade membership when github_membership is destroyed#1783

Merged
kfcampbell merged 10 commits intointegrations:mainfrom
jsifuentes:feat/downgrade-membership-on-destroy
Jul 14, 2023
Merged

feat: add ability to downgrade membership when github_membership is destroyed#1783
kfcampbell merged 10 commits intointegrations:mainfrom
jsifuentes:feat/downgrade-membership-on-destroy

Conversation

@jsifuentes
Copy link
Copy Markdown
Contributor

@jsifuentes jsifuentes commented Jul 9, 2023

Resolves #1782


Behavior

Before the change?

  • github_membership allows for a "create or update" resource creation, so if the membership exists before the resource is managed by Terraform then Terraform will just update the membership. When the resource is destroyed, membership from the org is always revoked.

After the change?

  • You can now add downgrade_on_destroy = true to a github_membership resource. Instead of revoking org membership, the membership role will be set to 'member' when the resource is destroyed.

Additional info

  • I added a new test case specifically to test this downgrade scenario. The function testAccGithubMembershipConfigDowngradable sets the role to admin and sets the downgrade_on_destroy to true. Since the Destroy no longer completely removes the membership during this test case, the membership is cleaned up during the CheckDestroy.

Pull request checklist

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Added the appropriate label for the given change

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes (Please add the Type: Breaking change label)
  • No

If Yes, what's the impact:

  • N/A

Pull request type

  • Feature/model/API additions: Type: Feature

@jsifuentes jsifuentes marked this pull request as ready for review July 9, 2023 23:11
Jacob Sifuentes and others added 4 commits July 10, 2023 22:15
@jsifuentes jsifuentes requested a review from kfcampbell July 11, 2023 19:41
@kfcampbell kfcampbell merged commit fabff68 into integrations:main Jul 14, 2023
jsifuentes added a commit to jsifuentes/terraform-provider-github that referenced this pull request Jul 17, 2023
… destroyed (integrations#1783)

* feat: add ability to downgrade membership on destroy

* add docs

* formatting

* formatting

* check membership status before downgrading

* fix lint

* fix lint

* Update github/resource_github_membership.go

Co-authored-by: Keegan Campbell <me@kfcampbell.com>

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
felixlut pushed a commit to felixlut/terraform-provider-github that referenced this pull request Jul 22, 2023
… destroyed (integrations#1783)

* feat: add ability to downgrade membership on destroy

* add docs

* formatting

* formatting

* check membership status before downgrading

* fix lint

* fix lint

* Update github/resource_github_membership.go

Co-authored-by: Keegan Campbell <me@kfcampbell.com>

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
avidspartan1 pushed a commit to avidspartan1/terraform-provider-github that referenced this pull request Feb 5, 2024
… destroyed (integrations#1783)

* feat: add ability to downgrade membership on destroy

* add docs

* formatting

* formatting

* check membership status before downgrading

* fix lint

* fix lint

* Update github/resource_github_membership.go

Co-authored-by: Keegan Campbell <me@kfcampbell.com>

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
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

Successfully merging this pull request may close these issues.

[FEAT]: Ability to downgrade org membership to 'member' on github_membership destroy

2 participants