If you are using PowerShell and trying to run a
terraform init, you may get an error as follows:
Error: error accessing remote module registry
Failed to retrieve available versions for module ... from registry.terraform.io: Failed to request discovery document: Get "https://registry.terraform.io/.well-known/terraform.json": read tcp x.x.x.x:xxxx->x.x.x.x: wsarecv: An existing connection was forcibly closed by the remote host..
Note that you will still be able to make a successful
curl request, but
terraform will fail!
You need to make sure you have a proxy set.
The Windows Command Prompt lets you set a proxy as follows:
PowerShell will still fail, as it required the proxy environment variables to also be set as follows: