skip to Main Content

I try to do a terraform init and it fails. This used to work before, not sure what changed. Any ideas on this please?

I am able to curl the same url and it works fine.

tf version: 1.1.5
aws version: 4.4.0

Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 4.4.0"...
2022-08-10T10:05:00.750-0700 [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json
2022-08-10T10:05:11.191-0700 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions
2022-08-10T10:05:21.196-0700 [ERROR] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions request failed: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
2022-08-10T10:05:21.196-0700 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions: retrying in 1s (1 left)
2022-08-10T10:05:22.198-0700 [INFO]  Previous request to the remote registry failed, attempting retry.
2022-08-10T10:05:32.199-0700 [ERROR] GET https://registry.terraform.io/v1/providers/hashicorp/aws/versions request failed: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/aws: could not query provider registry for registry.terraform.io/hashicorp/aws: the
│ request failed after 2 attempts, please try again later: Get "https://registry.terraform.io/v1/providers/hashicorp/aws/versions": net/http: request canceled
│ while waiting for connection (Client.Timeout exceeded while awaiting headers)```

2

Answers


  1. Chosen as BEST ANSWER

    Thank you for your inputs everyone.

    I found the issue. I had to set the dns of my Mac to 8.8.8.8

    I don’t know how/why but that worked.


  2. The latest version of AWS Provider for Terraform is 4.25.0. Try to change it from 4.4 to 4.25.0 and hope it will work.
    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search