how to use terraform in an internal network,
this network has set proxy to conncenct to cloud platform api.
but when I run “terraform init”,console told me “can not download provider”.
I also tried to download provider file and set nginx alias to forward it , but another problem happend
Hi @781058829,
Using Terraform in an environment that requires application-layer proxies is challenging because in typical use of Terraform there are many different components that all independently make network requests. For example: Terraform CLI itself when installing providers, each individual provider plugin when it makes requests to the remote API, and even some non-HTTP protocols like SSH if you are using remote provisioners.
As far as possible, Terraform supports the conventional environment variables HTTP_PROXY
, HTTP_PROXY
and NO_PROXY
to configure clients to use the specified proxy server(s). Not all of the vendor SDKs that Terraform relies on can support proxies, but I would suggest setting these environment variables to specify to your network’s proxy server and then trying again to see if it succeeds.
Depending on what you intend to do with Terraform, it might not be possible to perform all operations through your proxy server. If that’s true then an alternative would be to create a VM in your chosen cloud platform and run Terraform from there, using the cloud platform’s internet connection instead of your internal network’s.
(You can find more information on these conventional environment variables in the article We need to talk: Can we standardize NO_PROXY?. When considering that article, Terraform Core’s support for the environment variables should match what’s supported for “Go”, since Terraform Core is relying on the Go standard library HTTP client to make its requests. That isn’t necessarily true for all Terraform providers, and isn’t true for non-HTTP network requests.)
Thanks for your suggestion , however the proxy server can not connect to registry.terraform.io , so I tried to configure the tf file to use a local file as provider that I download the provider and upload to my terraform running environment