【问题标题】:Terraform init connection time outs searching for providerTerraform 初始化连接超时搜索提供程序
【发布时间】:2022-08-14 08:44:21
【问题描述】:

我尝试做一个 terraform init,但它失败了。这以前可以工作,不知道发生了什么变化。请问有什么想法吗?

我能够卷曲相同的网址,并且效果很好。

tf 版本:1.1.5 aws 版本: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)```
  • 也许有一个暂时的停机时间,也许你有奇怪的网络设置。它是否在其他机器上工作,它最后一次工作是什么时候,它是什么时候第一次停止工作?
  • 这取决于您在哪里进行curlterraform init。如果两者都在同一台机器上运行,.terraform 目录会发生一些奇怪的事情。如果不是,则在拦截流量之间可能有网络设备。
  • 使用 Curl 时,请求似乎需要很长时间?在 Unix 系统上,您可以运行 time curl ... 来查看该请求大约需要多长时间。我想知道 Curl 是否比 Terraform 有更慷慨的超时。如果您尝试此操作,我建议您也更新您的问题,以包括您运行的确切命令及其产生的完整输出,因此更容易将其与 Terraform 所做的比较。

标签: amazon-web-services terraform terraform-provider-aws terraform0.12+


【解决方案1】:

谢谢大家的投入。

我发现了这个问题。我必须将我的 Mac 的 dns 设置为 8.8.8.8

我不知道如何/为什么,但这有效。

【讨论】:

    【解决方案2】:

    适用于 Terraform 的 AWS Provider 的最新版本是 4.25.0。尝试将其从 4.4 更改为 4.25.0,并希望它会工作。

    【讨论】:

    • 这与提供程序版本无关。
    猜你喜欢
    • 2013-11-29
    • 1970-01-01
    • 2019-10-24
    • 1970-01-01
    • 2018-03-25
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 2013-09-07
    相关资源
    最近更新 更多