升级到Terraform v0.13.4后无法验证已安装的提供程序

时间:2020-10-07 20:37:29

标签: terraform terraform-provider-aws

我最近将Terraform升级到v0.13.4,现在在启动我的工作区时遇到问题。

- terraform.io/builtin/terraform is built in to Terraform
- Using previously-installed hashicorp/aws v3.9.0
- Using previously-installed hashicorp/archive v1.3.0

Error: Failed to validate installed provider

Validating provider hashicorp/archive v1.3.0 failed: provider binary not
found: could not find executable file starting with terraform-provider-archive

我尝试将所需的提供者指向此处:

terraform {
  required_providers {
    archive = {
      source = "hashicorp/archive"
      version = "1.3.0"
    }
    aws = {
      region                  = "us-east-2"
      #profile                 = "arm-sandbox"
    }
}

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

以前安装的 archive 提供程序版本 (1.3.0) 可能在 Terraform 0.13+ 中没有得到正确支持,或者安装不正确或可能已损坏。

考虑更新到提供程序的最新版本,随后也会下载最新版本。与以前的版本相比,0.13+ 中提供程序的处理方式不同,因此最好在您的工作区中运行 terraform upgrade0.13 以确保所有内容都针对 Terraform 0.13+ 进行正确转换和格式化。

terraform {
  required_providers {
    archive = {
      source  = "hashicorp/archive"
      version = "2.1.0"
    }
  }
}

正如@martin-atkins 正确指出的那样,aws region 不能在 required_providers 块内指定,而应该在提供程序块中:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.37.0"
    }
  }
}

provider "aws" {
  region = "us-east-2"
}