-
Notifications
You must be signed in to change notification settings - Fork 775
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
Missing state for membership in nested teams #168
Comments
Hi @joebowbeer ! Thank you for submitting this issue! I was able to reproduce this as well. While digging into it I found a very interesting implementation in the GitHub API where, depending on the media type passed, the API will return child team members along with parent team members when requesting team members of a parent team (https://developer.github.com/v3/teams/members/#get-team-membership). Thus, when we go to GetTeamMembership on the parent team resource, it shows the member of the child team as a member as well. Unfortunately, the go-github SDK sets this media type for us, so I don't see how we could do this without reimplementing or forking the SDK. (https://github.com/google/go-github/blob/0573e88402f1db392537e0cbb2c79f1c03d1c6a0/github/github.go#L95) Please let me know if you have further questions or if I can help in any way. Thanks! |
Is the SDK still unable to differentiate between the two? |
hi @docwhat @joebowbeer! so the v3 github API still returns child team members w/in a parent team as referenced in the comments above; however, the github graphql api v4 provides the ability to explicitly differentiate membership types within a team (https://developer.github.com/v4/enum/teammembershiptype/) such that one can retrieve a team's immediate members vs. child_team members. It looks like adding the graphql client is in the works and tagged for |
I have only written a teams data source so far - https://github.com/terraform-providers/terraform-provider-github/pull/339. The schema is radically different, so some discussion is probably warranted around it. |
@patrickmarabeas I'd be happy to contribute to updating the team_membership data_source/resource if it hasn't been started on. |
I would like some feedback on the schema before any further development effort goes into it. If you want some working code to test with - play around with https://github.com/patrickmarabeas/terraform-provider-github-v4 There's some additional work that needs to go into how we toggle v4 resources that I'm currently working on before any actual resources will make it in. |
I have not looked into this yet. I want to get this one figured out but think we should focus on a plan to toggle v4 resources first. |
👋 Hey Friends, this issue has been automatically marked as |
👋 Hey Friends, this issue has been automatically marked as |
Say a user is a member of team Child which is a child of team Parent, but the user is not directly a member of team Parent.
Then the imported state shows the user to be a member of both teams:
Adding a new user to both teams via terraform results in similar terraform state, that is the new user is shown to be a member of both teams in the terraform state. However, the result on GitHub is different: the user has been added to both teams, instead of only being a member of the child team.
How to add a user to a child team without adding them to the parent, or requiring a subsequent import?
Terraform Version
Terraform v0.11.8
Affected Resource(s)
github_team_membership
Repro steps
terraform plan
References
Related to #47
The text was updated successfully, but these errors were encountered: