CiscoDevNet / terraform-provider-iosxe

Terraform Cisco IOS-XE Provider
https://registry.terraform.io/providers/CiscoDevNet/iosxe
Mozilla Public License 2.0
58 stars 22 forks source link

Please add support for using SOCKS proxy #187

Open cpiatnit opened 1 month ago

cpiatnit commented 1 month ago

Here is my scenario

our laptops ◄----►Jumpbox1 ◄----►Jumpbox2 ◄----►Router ◄----►devices to be configured

as the provider uses https for this please consider scenarios like this.

After experimenting with this and reading a little about how it should work it seems that this could be handled using socks proxy I do not know Golang to test this. Chatgpt or Google's version of AI applied to searching is suggesting the below

You can set the following environment variables to configure the proxy: HTTP_PROXY: Set this to the address of your HTTP proxy server. HTTPS_PROXY: Set this to the address of your HTTPS proxy server. NO_PROXY: Set this to a comma-separated list of hosts that should bypass the proxy. Code

export HTTP_PROXY=http://your-proxy-server:port/ export HTTPS_PROXY=http://your-proxy-server:port/ export NO_PROXY=localhost,127.0.0.1

If you are writing custom Go code that interacts with Terraform providers, you can explicitly check for and use the proxy settings from the environment variables. Go

package main

import ( "fmt" "net/http" "os" )

func main() { // ... other code

// Get proxy settings from environment variables httpProxy := os.Getenv("HTTP_PROXY") httpsProxy := os.Getenv("HTTPS_PROXY")

// Create an HTTP client with proxy settings client := &http.Client{} if httpProxy != "" { client.Transport = &http.Transport{ Proxy: http.ProxyURL(httpProxy), } }

// ... use the client to make requests }