feat: add github_client_config data source#3419
Open
jaredfholgate wants to merge 3 commits into
Open
Conversation
Adds a new `github_client_config` data source that exposes the provider's effective configuration: the resolved `owner`, whether that owner is an organization, the authenticated `username`, and the configured `base_url`. This is useful when `owner` is supplied via the `GITHUB_OWNER` environment variable (and therefore not visible in HCL) or when callers need the login of the user the provider is authenticating as. Resolves integrations#3418
|
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with |
|
Lovely addition, fills a real gap. The GITHUB_OWNER env var being invisible to HCL has always been annoying for reusable modules. Follows the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #3418
Before the change?
HCL. In particular, when
owneris supplied via theGITHUB_OWNERenvironment variable it is not visible in configuration, and there is
no first-class way to discover the login of the user the provider is
authenticating as.
After the change?
github_client_configdata source exposes:owner— the resolved owner (provider argument /GITHUB_OWNERenv var, falling back to the authenticated user's login).
is_organization— whether the resolvedowneris an organization.username— the login of the user the provider is authenticated as.base_url— the GitHub API base URL the provider is using.other providers (e.g.
azurerm_client_config,google_client_config).Test evidence
Authenticated (organization) mode — the authenticated sub-test runs and
the anonymous sub-test skips:
Anonymous mode — the anonymous sub-test runs and the authenticated
sub-test skips:
Together the two runs cover both sub-tests.
Manual local test
Built the provider locally and verified end-to-end with
terraform planagainst the following configuration:
Output:
Pull request checklist
Does this introduce a breaking change?