Terraform init: could not connect to registry.terraform.io

When I run terraform init I receive the error:

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": net/http: request canceled while waiting
│ for connection (Client.Timeout exceeded while awaiting headers)

I have tried to reach the site “registry.terraform.io” from my browser and everything worked fine.

But, when I tried to ping to registry.terraform.io, I received:

ping: cannot resolve registry.terraform.io: Unknown host

Something even weirder happened when I run the ping command immediately after I entered the website: registry.terraform.io. It successfully pinged! But 1 sec after it when I tried it again, it failed.

Screen Shot 2022-01-24 at 19.27.06

It sounds like you had some trouble with DNS. Not sure if that was due to your local ISP thing but you could switch to some other public DNS services (e.g., “”, “”, etc) to see if that mitigates the issue. And if so, that’s likely your ISP/region-specific issue that we can’t help much, unfortunately.

Otherwise, my best bet is to reach out to Fastly support (support@fastly.com) with the debug output collected on https://www.fastly-debug.com/ and see if they can give you any insights.