我正在尝试运行 terraform init 但收到此错误:无法查询可用的提供程序包

时间:2021-07-12 11:05:12

标签: terraform terraform-provider-aws hashicorp

Terraform init 出现以下错误。没有升级任何版本,几天前它可以工作,但突然出现故障。

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": read: connection reset by peer


when I run curl from the server, it is not able to connect as well. 
 curl https://registry.terraform.io/
 curl: (35) OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to registry.terraform.io:443

1 个答案:

答案 0 :(得分:1)

您所在的网络是否管理员可能在您和互联网之间安装了代理?如果是这样,您需要获取签名证书并在您的提供商中配置它们。

如果您使用的是家庭网络或公共网络,这就是中间人攻击。请勿使用此网络。

如果您拥有证书,则可以通过将 cacert_pathcert_pathkey_path 指向相应的 .pem 文件在您的 aws 提供程序中配置它们。

如果您已验证有正当理由在您和 Internet 之间使用代理,您没有接触生产,并且证书很难获得,您可以通过设置 insecure = true 来测试您的代码在您的提供商上。显然,不要签入。