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: Add data source github_users #900

Merged

Conversation

pascal-hofmann
Copy link
Contributor

@pascal-hofmann pascal-hofmann commented Sep 7, 2021

This pull request adds a github_users datasource that allows to check the existence of multiple users at once.

login and node_id of users that could be found can be accessed via logins / node_ids.

All unknown logins can be accessed via unknown_logins.

Background: Login to our companies internal GitHub Enterprise instance is done via Microsoft Azure AD and users get automatically created once they login for the first time. Unfortunately there is currently no way to check whether a user already exists via terraform. The existing github_user data source aborts planning when unknown users are encountered.

In order to manage the users team membership via terraform we thus currently have to maintain a separate list of users that exist/do not exist in our GitHub Enterprise instance. This data source would solve this problem, as it offers a way to check for the existence of a given user without bailing out.

Technical details:
The new datasource uses the GraphQL API in order to avoid doing multiple requests.

@pascal-hofmann pascal-hofmann force-pushed the feat/data_source_github_users_graphql branch 3 times, most recently from c25a24d to 14a1ba3 Compare September 7, 2021 16:18
@jcudit jcudit added this to the v4.16.0 milestone Sep 7, 2021
@jcudit jcudit modified the milestones: v4.16.0, v4.17.0 Sep 28, 2021
Copy link
Contributor

@jcudit jcudit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far. Can we get the linter warning fixed up?

@pascal-hofmann pascal-hofmann force-pushed the feat/data_source_github_users_graphql branch from 14a1ba3 to 26403fb Compare September 29, 2021 06:28
@pascal-hofmann
Copy link
Contributor Author

Looking good so far. Can we get the linter warning fixed up?

This should be fixed now. I chose to just ignore the error, because Write never returns one according to the Hash interface.

Copy link
Contributor

@jcudit jcudit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙇🏾 thanks for this contribution!

@jcudit jcudit merged commit e05d2ab into integrations:main Oct 17, 2021
@pascal-hofmann pascal-hofmann deleted the feat/data_source_github_users_graphql branch October 18, 2021 06:22
kfcampbell pushed a commit to kfcampbell/terraform-provider-github that referenced this pull request Jul 26, 2022
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.

2 participants