abctest
abctest

Reputation: 163

How to set up terraform behind proxy?

I am trying to run terraform behind a proxy on Windows. I have already set my proxy on CMD by doing: set HTTP_PROXY and set HTTPS_PROXY.

Here is the error I am getting:

Initializing provider plugins...
- Finding latest version of hashicorp/aws...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/aws:
could not connect to registry.terraform.io: Failed to request discovery
document: Get "https://registry.terraform.io/.well-known/terraform.json":
proxyconnect tcp: tls: first record does not look like a TLS handshake 

There are no problem in my infrastructure as I have already tried it on another computer with no proxy and it works.

Thank you in advance.

Upvotes: 6

Views: 21651

Answers (1)

Asri Badlah
Asri Badlah

Reputation: 2123

I am using terraform proxy with password, by setting environment variables like the following:

HTTP_PROXY=http://<username>:<password>@<proxy>:<port>
HTTPS_PROXY=http://<username>:<password>@<proxy>:<port>

set HTTPS_PROXY to http url not https

Upvotes: 4

Related Questions