"no available releases match the given constraints ~> 2.1.28" 的地形初始化步骤

terraform init step with "no available releases match the given constraints ~> 2.1.28"

实际上 - 收到了更换的苹果 mac 笔记本电脑(原来的那台由于存储不当而崩溃),我正在使用配置重新设置所有内容,我被这个“terraform init”步骤卡住了并受阻,

已安装的 terraform 版本为 0.13.6 安装的 AWS CLI 是 2.1.32

当“terraform init”被触发时,我收到以下错误,感谢任何帮助,以便我可以解锁我的工作。

Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Using previously-installed hashicorp/kubernetes v1.13.3
- Using previously-installed hashicorp/external v1.1.2
- Finding hashicorp/aws versions matching "~> 2.1.28"...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/aws: no available releases match the given constraints ~>
2.1.28

通过使用~> 2.1.28,你是说你将使用任何2.1.x版本,只要bugfix版本高于28。最高的2.1版本是2.1.0 .

你确定不是~> 2.28.1

创建一个 config.tf 文件并添加此行

  required_providers {
    aws = {
      source  = "registry.terraform.io/hashicorp/aws"
      version = "=2.28.0" ## or whatever version you need
    }
  }