-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add proxy support #95
Add proxy support #95
Conversation
750ee66
to
428142b
Compare
Thanks for your contribution @timwisbauer-contsec , can you please add some unit tests to your change? |
Add a new optional parameter to the provider configuration to allow for setting a proxy. Using a proxy can be an easier method for connecting to clusters within a VPC. Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com>
428142b
to
26b02d3
Compare
@prudhvigodithi thank you for the review. I've added some unit tests to validate the proxy URL can be configured. |
Hey @timwisbauer-contsec thanks for adding unit tests, can you please resolve the conflicts and generate the documentation for this change ? Please check https://github.com/hashicorp/terraform-plugin-docs. |
430256c
to
2f148f2
Compare
Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com>
@prudhvigodithi I have resolved the conflicts and generated documentation. Thanks for your attention and please let me know if there's anything else I can do to help. |
Hey @timwisbauer-contsec thanks again, on qq, so if user uses |
Hey @prudhvigodithi the proxy URL is separate from any credentials. The provider still needs to authenticate to the OpenSearch instance whether they're connecting to AWS or another OpenSearch instance. For example, in our environment using the forked version I have the provider configured like this
The provider still needs to authenticate to AWS. In my case it reads my environment variable |
Thanks @timwisbauer-contsec so correct me if I'm wrong the Example
So does the above code work ? |
@prudhvigodithi haproxy and nginx are reverse proxies which are different than the forward proxy configured here. Cloudflare has a decent explanation of the difference here: https://www.cloudflare.com/learning/cdn/glossary/reverse-proxy/ That being said, a proxy URL can alternatively use HTTP or HTTPS as the protocol so your example of
may be valid depending on the network topology between the client running terraform and the OpenSearch instance. |
Thanks @timwisbauer-contsec, my point is irrespective of proxy or revery proxy as the code looks generic
does this logic work for any proxy ? |
@prudhvigodithi yes, it works for any forward proxy. Basically if the HTTP transport in Go supports it you can use it here. |
Thanks, just thinking aloud, what If a user configure a revere proxy |
@prudhvigodithi yeah this setting just needs to meet the URL requirements here: https://pkg.go.dev/net/http#ProxyFromEnvironment As long as the URL you've provided for the proxy is capable of handling those requests then this setting will work. I haven't used nginx as a forward proxy before, but it looks like it's possible to be configured that way: https://www.baeldung.com/nginx-forward-proxy |
Thanks @timwisbauer-contsec LGTM. |
* Add proxy support Add a new optional parameter to the provider configuration to allow for setting a proxy. Using a proxy can be an easier method for connecting to clusters within a VPC. Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> * Add proxy support docs Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> --------- Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com>
* Add proxy support Add a new optional parameter to the provider configuration to allow for setting a proxy. Using a proxy can be an easier method for connecting to clusters within a VPC. Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> * Add proxy support docs Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> --------- Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com>
Signed-off-by: Aaron Miller <afrodidact@outlook.com> Add anomaly detection (opensearch-project#105) * Add anomaly detection Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Add test for update Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Add audit config in anomaly detector test Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Format terraform in test Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> --------- Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> Signed-off-by: Aaron Miller <afrodidact@outlook.com> When the provider assumes a given role, don't use the default profile… (opensearch-project#87) * When the provider assumes a given role, don't use the default profile if the profile is not given, but allow aws-sdk-go to find the credentials using the default credential provider chain (opensearch-project#86) Signed-off-by: Massimo Battestini <massimob76@gmail.com> * Adds unit tests for AWS profile change (opensearch-project#86) Signed-off-by: Massimo Battestini <massimob76@gmail.com> --------- Signed-off-by: Massimo Battestini <massimob76@gmail.com> Signed-off-by: Aaron Miller <afrodidact@outlook.com> Add step to generate terraform provider documentation by running tfplugindocs (opensearch-project#120) Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> Signed-off-by: Aaron Miller <afrodidact@outlook.com> Improve documentation for HTTP basic authentication (opensearch-project#114) * Update template Signed-off-by: Jason Parraga <sovietaced@gmail.com> * Generate docs using tfplugindocs Signed-off-by: Jason Parraga <sovietaced@gmail.com> --------- Signed-off-by: Jason Parraga <sovietaced@gmail.com> Signed-off-by: Aaron Miller <afrodidact@outlook.com> fix complaints in errcheck linter Signed-off-by: Aaron Miller <afrodidact@outlook.com> Add proxy support (opensearch-project#95) * Add proxy support Add a new optional parameter to the provider configuration to allow for setting a proxy. Using a proxy can be an easier method for connecting to clusters within a VPC. Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> * Add proxy support docs Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> --------- Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> Add anomaly detection (opensearch-project#105) * Add anomaly detection Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Add test for update Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Add audit config in anomaly detector test Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Format terraform in test Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> --------- Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> When the provider assumes a given role, don't use the default profile… (opensearch-project#87) * When the provider assumes a given role, don't use the default profile if the profile is not given, but allow aws-sdk-go to find the credentials using the default credential provider chain (opensearch-project#86) Signed-off-by: Massimo Battestini <massimob76@gmail.com> * Adds unit tests for AWS profile change (opensearch-project#86) Signed-off-by: Massimo Battestini <massimob76@gmail.com> --------- Signed-off-by: Massimo Battestini <massimob76@gmail.com> Add step to generate terraform provider documentation by running tfplugindocs (opensearch-project#120) Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> Improve documentation for HTTP basic authentication (opensearch-project#114) * Update template Signed-off-by: Jason Parraga <sovietaced@gmail.com> * Generate docs using tfplugindocs Signed-off-by: Jason Parraga <sovietaced@gmail.com> --------- Signed-off-by: Jason Parraga <sovietaced@gmail.com> Add proxy support (opensearch-project#95) * Add proxy support Add a new optional parameter to the provider configuration to allow for setting a proxy. Using a proxy can be an easier method for connecting to clusters within a VPC. Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> * Add proxy support docs Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> --------- Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> Add anomaly detection (opensearch-project#105) * Add anomaly detection Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Add test for update Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Add audit config in anomaly detector test Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> * Format terraform in test Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> --------- Signed-off-by: Rupa Lahiri <rupacoach@gmail.com> Improve documentation for HTTP basic authentication (opensearch-project#114) * Update template Signed-off-by: Jason Parraga <sovietaced@gmail.com> * Generate docs using tfplugindocs Signed-off-by: Jason Parraga <sovietaced@gmail.com> --------- Signed-off-by: Jason Parraga <sovietaced@gmail.com> Add proxy support (opensearch-project#95) * Add proxy support Add a new optional parameter to the provider configuration to allow for setting a proxy. Using a proxy can be an easier method for connecting to clusters within a VPC. Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> * Add proxy support docs Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com> --------- Signed-off-by: Tim Wisbauer <tim.wisbauer@contrastsecurity.com>
Description
Add a new optional parameter to the provider configuration to allow for setting a proxy. Using a proxy can be an easier method for connecting to clusters within a VPC.
Issues Resolved
Closes #93
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.