integrations / terraform-provider-github

Terraform GitHub provider
https://www.terraform.io/docs/providers/github/
MIT License
907 stars 748 forks source link

Provider doesn't seem to use proxy settings #1509

Open raphaelperrin24 opened 1 year ago

raphaelperrin24 commented 1 year ago

Using TFE on premise behind a company proxy.

On Applying plan, we get the error below: Error: Post "https://api.github.com/user/repos": dial tcp 140.82.121.5:443: connect: connection timed out

Wondering if the provider respects the setting. In the worker container, the proxy settings are set as environment variables.

mkilchhofer commented 1 year ago

Maybe somehow related:

kfcampbell commented 1 year ago

The GitHub provider does not have any proxy-related code or behavior; I imagine that the answer may lie in either the go-github package or else Terraform proxy behavior as a whole. I'm going to close this issue now as there hasn't been a response in quite some time, though please feel free to reopen if you feel it's warranted.

mkilchhofer commented 1 year ago

@kfcampbell can you reopen this please? The issue referenced above shows exactly how to implement this. It has to be setup on go's http client this is reused in the library google/go-github.

kfcampbell commented 1 year ago

The issue referenced above shows exactly how to implement this.

There's not a linked issue above. What issue are you referring to?

It has to be setup on go's http client this is reused in the library google/go-github.

What does that mean about the provider's involvement? It seems unrelated.

smittnacht commented 11 months ago

Hi @kfcampbell, I agree with the assessment from @mkilchhofer and @raphaelperrin-swisspost that the current implementation doesn't adhere to proxy settings when making requests to GitHub.

Upon examining the go-github project, which is responsible for creating the actual HTTP client, we find two methods for client creation: NewClient() and NewClientWithEnvProxy() (introduced in https://github.com/google/go-github/pull/2686). Since you're employing the NewClient() method without explicitly supplying any proxy-related configuration, no proxy is being utilized at all.

I believe a straightforward solution would be to simply replace NewClient() with NewClientWithEnvProxy(). This would ensure that proxy settings are respected when making requests to GitHub.

Please share your thoughts on this approach.

mkilchhofer commented 11 months ago

There's not a linked issue above. What issue are you referring to?

This one here:

What does that mean about the provider's involvement? It seems unrelated.

See detailed answer of @smittnacht

smittnacht commented 11 months ago

@mkilchhofer @kfcampbell @raphaelperrin-swisspost could someone of you or any other maintainer reopen this issue please?

kfcampbell commented 10 months ago

Reopened; sorry about that. I'm receptive to ideas or PRs are about how to fix this!

github-actions[bot] commented 1 month ago

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

mkilchhofer commented 1 month ago

Not stale

ytausch commented 1 week ago

Related to this issue:

If anyone wants to use Burp as a proxy for easier debugging, I've used the invisible proxy feature of Burp to circumvent the current limitations of missing proxy support: gist