If you’re encountering the following error when running terraform init
:
Error: Failed to query available provider packages
Could not retrieve the list of available versions for provider hashicorp/azurerm: could
not connect to registry.terraform.io: failed to request discovery document: Get
"https://registry.terraform.io/.well-known/terraform.json": read tcp
[2a01:cb00:11c1:5600:8993:f823:4f83:596d]:56033->[2600:9000:262b:8600:16:1aa3:1440:93a1]:443:
wsarecv: An existing connection was forcibly closed by the remote host.
Then you may need to remove IPv6 from your network adapter. This can be done by following the steps below:
-
Open the Network and Sharing Center.
-
Click on the network adapter you’re using.
-
Click on Properties.
-
Uncheck Internet Protocol Version 6 (TCP/IPv6).
-
Click OK.
You should now be able to run
terraform init
successfully.