feat: Add data source github_users #900
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a
github_users
datasource that allows to check the existence of multiple users at once.login
andnode_id
of users that could be found can be accessed vialogins
/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.