我在 Mac M1 上使用 Terraform v1.0.11。当我尝试运行
terraform init
时,遇到以下错误:
Initializing provider plugins...
- Finding latest version of hashicorp/local...
- Finding latest version of hashicorp/null...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Finding latest version of hashicorp/random...
- Finding latest version of hashicorp/template...
- Finding latest version of hashicorp/external...
- Installing hashicorp/external v2.1.0...
- Installed hashicorp/external v2.1.0 (signed by HashiCorp)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)
- Installing hashicorp/null v3.1.0...
- Installed hashicorp/null v3.1.0 (signed by HashiCorp)
- Using previously-installed hashicorp/aws v3.53.0
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
╷
│ Error: Incompatible provider version
│
│ Provider registry.terraform.io/hashicorp/template v2.2.0 does not have a package available for your current platform, darwin_arm64.
│
│ Provider releases are separate from Terraform CLI releases, so not all providers are available for all platforms. Other versions of this provider
│ may have different platforms supported.
我的提供商提供商信息:
terraform {
required_providers {
aws = {
version = "~> 3.53.0"
}
}
}
我了解提供商版本不适用于 M1。有什么解决办法吗?
我尝试使用这个:https://github.com/hashicorp/terraform/issues/27257#issuecomment-754777716,但使用提供程序版本3.53.0,但遇到问题。
这个问题有解决办法吗?
您可以使用他们在这个答案上所说的内容在您的M1上运行,即为您的架构编译资源。
但是 template 是已弃用的资源,您可以使用在 M1 上正常工作的 templatefile。
我能够按照以下步骤解决该问题。
brew install kreuzwerker/taps/m1-terraform-provider-helper
m1-terraform-provider-helper activate
如果遇到校验和错误,您可能必须删除
.terraform.lock.hcl
文件,然后再次运行 terraform plan
和 terraform apply
。