CiscoDevNet / terraform-provider-nxos

Terraform Cisco NX-OS Provider
https://registry.terraform.io/providers/netascode/nxos
Mozilla Public License 2.0
9 stars 10 forks source link

Please add support for a scenario when the devices to be configured sit behind on or more jump boxes #265

Open cpiatnit opened 3 weeks ago

cpiatnit commented 3 weeks 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.

cpiatnit commented 2 weeks ago

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

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

}