Error: Failed to query available provider packages

I am new to terraform although I did get it running about a year ago.

I am trying again now but I am having problems at the 1st step. terraform init on a brand new project (the terraform-docker-demo project from the https://learn.hashicorp.com/tutorials/terraform/install-cli instructions)

It could be some old config somewhere but I did delete my /usr/local/bin/terraform folder and reinstall the latest version so it should be quite clean.

Here is my trace log…

paul@MyMac terraform-docker-demo % terraform init
2020/09/22 09:59:31 [INFO] Terraform version: 0.13.3
2020/09/22 09:59:31 [INFO] Go runtime version: go1.14.7
2020/09/22 09:59:31 [INFO] CLI args: string{"/usr/local/bin/terraform", “init”}
2020/09/22 09:59:31 [DEBUG] Attempting to open CLI config file: /Users/paul/.terraformrc
2020/09/22 09:59:31 [DEBUG] File doesn’t exist, but doesn’t need to. Ignoring.
2020/09/22 09:59:31 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/09/22 09:59:31 [DEBUG] ignoring non-existing provider search directory /Users/paul/.terraform.d/plugins
2020/09/22 09:59:31 [DEBUG] ignoring non-existing provider search directory /Users/paul/Library/Application Support/io.terraform/plugins
2020/09/22 09:59:31 [DEBUG] ignoring non-existing provider search directory /Library/Application Support/io.terraform/plugins
2020/09/22 09:59:31 [INFO] CLI command args: string{“init”}

Initializing the backend…
2020/09/22 09:59:31 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/09/22 09:59:31 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/09/22 09:59:31 [DEBUG] New state was assigned lineage “22591307-22ae-5837-7e84-15958333507f”
2020/09/22 09:59:31 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2020/09/22 09:59:31 [TRACE] Meta.Backend: instantiated backend of type
2020/09/22 09:59:31 [DEBUG] checking for provisioner in “.”
2020/09/22 09:59:31 [DEBUG] checking for provisioner in “/usr/local/bin”
2020/09/22 09:59:31 [INFO] Failed to read plugin lock file .terraform/plugins/darwin_amd64/lock.json: open .terraform/plugins/darwin_amd64/lock.json: no such file or directory
2020/09/22 09:59:31 [TRACE] Meta.Backend: backend does not support operations, so wrapping it in a local backend
2020/09/22 09:59:31 [TRACE] backend/local: state manager for workspace “default” will:

  • read initial snapshot from terraform.tfstate
  • write new snapshots to terraform.tfstate
  • create any backup at terraform.tfstate.backup
    2020/09/22 09:59:31 [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
    2020/09/22 09:59:31 [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that’s okay
    2020/09/22 09:59:31 [TRACE] statemgr.Filesystem: read nil snapshot

2020/09/22 09:59:31 [TRACE] providercache.fillMetaCache: scanning directory .terraform/plugins
Initializing provider plugins…
2020/09/22 09:59:31 [TRACE] getproviders.SearchLocalDirectory: .terraform/plugins is a symlink to .terraform/plugins
2020/09/22 09:59:31 [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json
2020/09/22 09:59:31 [TRACE] HTTP client GET request to https://registry.terraform.io/.well-known/terraform.json

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider
terraform-providers/docker: 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)