Featured image of post How to Remove IPv6 from Network Adapter as a Solution for Terraform Init Error

How to Remove IPv6 from Network Adapter as a Solution for Terraform Init Error

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:

  1. Open the Network and Sharing Center.

    Network Adapter Properties

  2. Click on the network adapter you’re using.

    Choose Wifi

  3. Click on Properties.

    Click Properties

  4. Uncheck Internet Protocol Version 6 (TCP/IPv6).

    Uncheck IPv6

  5. Click OK.

    You should now be able to run terraform init successfully.

    Success terraform init