In case you are utilizing PowerShell and attempting to run a terraform init
, you might get an error as follows:
Error: error accessing distant module registry
Did not retrieve obtainable variations for module ... from registry.terraform.io: Did not request discovery doc: Get "https://registry.terraform.io/.well-known/terraform.json": learn tcp x.x.x.x:xxxx->x.x.x.x: wsarecv: An present connection was forcibly closed by the distant host..
Notice that you’ll nonetheless be capable of make a profitable curl
request, however terraform
will fail!
The issue
It’s worthwhile to ensure you have a proxy set.
The Home windows Command Immediate enables you to set a proxy as follows:
SET HTTP_PROXY=http://<USER>:<PASSWORD>@proxy.host.com:8080
SET HTTPS_PROXY=http://<USER>:<PASSWORD>@proxy.host.com:8080
SET NO_PROXY=.yourcompany.com
The answer
PowerShell will nonetheless fail, because it required the proxy surroundings variables to even be set as follows:
[Environment]::SetEnvironmentVariable("HTTP_PROXY","http://<USER>:<PASSWORD>@proxy.host.com:8080/", [EnvironmentVariableTarget]::Course of)
[Environment]::SetEnvironmentVariable("HTTPS_PROXY","http://<USER>:<PASSWORD>@proxy.host.com:8080/", [EnvironmentVariableTarget]::Course of)
[Environment]::SetEnvironmentVariable("NO_PROXY",".yourcompany.com", [EnvironmentVariableTarget]::Course of)