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

[FEAT]: What should github_membership do if the invitation is expired? #1518

Open
1 task done
LDVSOFT opened this issue Jan 30, 2023 · 5 comments
Open
1 task done
Labels
Status: Needs info Full requirements are not yet known, so implementation should not be started Status: Pinned A way to keep old or long lived issues around Type: Feature New feature or request Type: Support Any questions, information, or general needs around the SDK or GitHub APIs

Comments

@LDVSOFT
Copy link

LDVSOFT commented Jan 30, 2023

Describe the need

Imagine I've invited a bunch people in the organisation at once using:

resource "github_membership" "student_membership" {
    for_each = var.students
    //...
}

By Murphy's law of course a couple of them missed the invitation email and all the reminders, and so their invitation was expired. However, the resource doesn't report an update in the plan: it has created an invitation, it exists, it's UP-TO-DATE. On the members page, however, you can see those expired invitations.

However, I can look at that that there is an «error» in the resource: the person is not in the organisation. One can look at that like the membership is tainted: for some reason the invitation in question needs to be recreated (or at least destroyed). Even more, if I would manually terraform taint that membership it would be recreated on next apply.

One way to do this could be by tracking in Terraform state the state of the invitation:

  • SENT when it's created,
  • ACCEPTED when it was accepted in time and the person is the member,
  • EXPIRED when it wasn't used,
  • MISSING if a person is not a member and the invitation is gone.
    (the wording is, of course, just a draft, and I might be missing cases).
    I don't know how exactly it is reported in the API, but it might be a partially client-side state.

That could provide several features:

  • One could track statuses of invitations in Terraform output,
  • On apply or plan, Terraform could show Objects have changed outside the Terraform prompt noting the status of the invitations,
  • If the invitation is expired: prompt to recreate it based on breaking change status: EXPIRED -> SENT (if still wanted) or dispose and destroy it (if not wanted anymore).

SDK Version

No response

API Version

No response

Relevant log output

$ terraform version
Terraform v1.3.7
on linux_amd64
+ provider registry.terraform.io/hashicorp/null v3.2.1
+ provider registry.terraform.io/integrations/github v5.13.0

Code of Conduct

  • I agree to follow this project's Code of Conduct
@LDVSOFT LDVSOFT added Status: Triage This is being looked at and prioritized Type: Feature New feature or request labels Jan 30, 2023
@LDVSOFT
Copy link
Author

LDVSOFT commented Jan 30, 2023

Looks like failed invitations (maybe this is a more appropriate status) are available at a separate endpoint: https://docs.github.com/en/rest/orgs/members?apiVersion=2022-11-28

@kfcampbell
Copy link
Member

Hmm...this is a great question. I'd also be curious to see what other providers that manage invitations do in this case.

@kfcampbell kfcampbell added Priority: Normal Status: Needs info Full requirements are not yet known, so implementation should not be started Type: Feature New feature or request Type: Support Any questions, information, or general needs around the SDK or GitHub APIs and removed Type: Feature New feature or request Status: Triage This is being looked at and prioritized labels Jan 30, 2023
@LDVSOFT
Copy link
Author

LDVSOFT commented Feb 7, 2023

I guess current behaviour is one of the options: we send invitation, if it's not accepted it's fine (yet seeing the invitation status would still be an improvement).

However, we could introduce some other provider-only option, like reinvite_if_expired, that could be set and force resource to be recreated upon reaching EXPIRED status.

Copy link

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Apr 20, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2024
@LDVSOFT
Copy link
Author

LDVSOFT commented May 2, 2024

Ay, two weeks of Stale checkup isn't that much! Oh well.

@kfcampbell kfcampbell reopened this May 3, 2024
@kfcampbell kfcampbell added Status: Pinned A way to keep old or long lived issues around and removed Status: Stale Used by stalebot to clean house labels May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs info Full requirements are not yet known, so implementation should not be started Status: Pinned A way to keep old or long lived issues around Type: Feature New feature or request Type: Support Any questions, information, or general needs around the SDK or GitHub APIs
Projects
None yet
Development

No branches or pull requests

3 participants