-
Notifications
You must be signed in to change notification settings - Fork 763
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
github/provider: introduce owner #464
Conversation
Gave this one a skim and am 👍 on the approach. It is a large diff so I plan on reading it over the next few days. Excited to see this 🚢 ! |
"organization": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
DefaultFunc: schema.EnvDefaultFunc("GITHUB_ORGANIZATION", nil), | ||
Description: descriptions["organization"], | ||
Deprecated: "Use owner field (or GITHUB_OWNER ENV variable)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
* `individual`: (Optional) Run outside an organization. When `individual` is true, the provider will run outside | ||
the scope of an organization. Defaults to `false`. | ||
|
||
* `anonymous`: (Optional) Authenticate without a token. When `anonymous` is true, the provider will not be able to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should call out this removal explicitly when we update the CHANGELOG for the release this goes out in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this was removed and not added to the docs ?, I had to come here to actually find out why, a note could have been usefull for people using the anonymous flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Damn, yes, it took me 2 hours to find out, and now I'm hardcoding the old plugin version. I need anonymous functionality to just pull the GitHub API IPs. That should never require tokens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CHANGELOG has been retroactively updated to help save time for anyone else affected.
Thanks for being quick to call this out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarcoDalco open a bug report to make sure such kind of requests are possible? The advantage of token is that it probably raises from GitHub API limits, but I haven't checked. A list of resources that one can use without token would be handy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abitrolly https://api.github.com/meta?q=hooks "You can add the IP address we use when delivering hooks to your server's allow list. To ensure that you're always checking the right IP address, you can use the /meta endpoint to find the address we use." https://developer.github.com/v3/guides/best-practices-for-integrators/ . Having to periodically update the whitelisted IPs is not great, but it's what seems to be suggested, at the moment. Then we could implement step 3. Currently we don't, but it would be good, but from a security perspective, in order to reduce the workload of reverse proxies, to reduce the impact of DDOS attacks, you should filter by public IP (step 2) before checking the secret, which happens after the TLS handshake (step 3).
Looks like For example GitLab doesn't use any kind of username for API access https://github.com/terraform-providers/terraform-provider-gitlab/blob/74c5685c69a9926c39c6beccebc89e29217494b0/gitlab/config.go#L14 |
@abitrolly this is good news, but may cause us to take a step back and re-evaluate how best to accomplish things. We are currently trying to leverage the |
@anGie44 - I've gotten this branch into a strange state by fixing conflicts using the web UI 😕. Also, I am now realizing that local test runs with the configured user account are incompatible: --- SKIP: TestAccGithubRepositoryWebhook_secret (0.50s)
resource_github_repository_webhook_test.go:73: Skipping because GITHUB_OWNER "github-terraform-test-user" is a user, not an organization.
PASS
ok github.com/terraform-providers/terraform-provider-github/github 0.867s Should a non-organization user be able to run acceptance tests? My original assumption was that |
63ee66e
to
86336ec
Compare
Yeah ideally we'd want an |
c268d2e
to
3e1f2ce
Compare
Is there a new Terraform provider version with these changes yet? I'm running into the same issue:
|
hi @emmasax4 👋 ! Not yet, but will be part of the next provider milestone which is the release of |
@anGie44 Awesome! Do we have any idea yet of when that next release will happen? |
we were facing some issues.. will dig deeper before re posting my deleted post... sorry for the noise |
@mariux no worries! I believe you should still be able to source your token from an environment variable and initialize the provider as usual however maybe we could reconsider moving this back to |
I was going to ask if the next version should be 3.0.0 because of potential compatibility break, but got lazy. :D |
😄 was considering a major version bump as well. Hoping the community is forthcoming with bug reports so we can mop them up during |
Seems to be only |
I can now confirm that with provider specifying any token (token does not need to be valid) via I am not sure if this is worth to be called a full-blown regression as we can easily fix this in our CI by providing the required env variable. (we run automated tests for our open source github modules) Should I open a bug report anyway? |
@mariux what could you do with anonymous GitHub provider before? |
@mariux yes, please. Capturing this is valuable. |
@@ -97,41 +87,33 @@ func init() { | |||
"token": "The OAuth token used to connect to GitHub. " + | |||
"If `anonymous` is false, `token` is required.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anonymous is mention here although it has been completely removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can now confirm that with provider
2.8.0
terraform validate
runs fine without a token and with2.9.0
terraform validate
needs a token to run.specifying any token (token does not need to be valid) via
GITHUB_TOKEN
environment variable fixes it.I am not sure if this is worth to be called a full-blown regression as we can easily fix this in our CI by providing the required env variable. (we run automated tests for our open source github modules)
Should I open a bug report anyway?
same thing here, we have many automated tests now failing
I just started receiving this Warning which seems spurious because I'm not using or declaring
My codebuild github config looks like this
|
We provide a module and run automated tests for static analysis and unit testing. The static analysis runs tools like
|
Continuing the work done by @elislusarczyk in #96 to support individual github accounts for repos
Changes here address last review comments in #96 :
GITHUB_ORGANIZATION
toGITHUB_OWNER
(across acctests as well)util.go
)organization
inprovider.go
IsOrganization
toOwner
structOutput of acceptance tests with
owner
set as Github User: