Terraform 初始化失败。错误:无法查询可用的提供程序包

sta*_*ner 5 infrastructure terraform terraform-provider-aws hashicorp

安装的 terraform 和 init 失败。

\n
- Finding hashicorp/aws versions matching "~> 4.16"...\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Failed to query available provider packages\n\xe2\x94\x82 \n\xe2\x94\x82 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\n\xe2\x94\x82 "https://registry.terraform.io/.well-known/terraform.json": x509: \xe2\x80\x9ccf-registry.tf-registry-prod-use1.terraform.io\xe2\x80\x9d certificate is not standards compliant\n
Run Code Online (Sandbox Code Playgroud)\n
terraform {\n  required_providers {\n    aws = {\n      source  = "hashicorp/aws"\n      version = "~> 4.16"\n    }\n  }\n\n  required_version = ">= 1.2.0"\n}\n\nprovider "aws" {\n  region  = "us-west-2"\n}\n\nresource "aws_instance" "app_server" {\n  ami           = "ami-830c94e3"\n  instance_type = "t2.micro"\n\n  tags = {\n    Name = "ExampleAppServerInstance"\n  }\n}\n\n
Run Code Online (Sandbox Code Playgroud)\n

我已卸载并重新安装它,但仍然无法工作。\nTerraform 版本:darwin_amd64 上的 Terraform v1.3.7

\n

Noe*_*pez 0

即使使用以前运行良好的模块,我也面临着同样的问题。在放弃网络问题(curl https://registry.terraform.io/.well-known/terraform.json)之后,尝试使用不同的文件和目录等。事实证明,重新启动对我来说成功了。