当我运行terraform plan
时,我希望看到一个计划,但我得到的却是
│ Error: Failed to load plugin schemas
│
│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema for provider registry.terraform.io/hashicorp/aws: failed to
│ instantiate provider "registry.terraform.io/hashicorp/aws" to obtain schema: Unrecognized remote plugin message:
│
│ This usually means that the plugin is either invalid or simply
│ needs to be recompiled to support the latest protocol...
系统为:arm64 m1 - Monterey - TFEnv - Terraform 1.1.9
解决方案
解释- 通过Apple的Rosetta运行amd64 M1的Go运行时的问题
- TFenv安装了amd64版本的Terraform而不是arm64。
补丁通过将变量GODEBUG=asyncpreemptoff=1
添加到您的地形前面或将其添加到您的bash配置文件中来设置它。
<<h3>修复/h3>确保你的系统正在运行正确的版本。
➜ terraform version
Terraform v1.1.9
on darwin_arm64
如果您在M1上运行terraform version
时看到darwin_amd64
,请尝试再次安装Terraform。
与TFenv
TFENV_ARCH=arm64 tfenv install 1.2.4
tfenv use 1.2.4
详细信息- https://github.com/hashicorp/terraform-provider-aws/issues/23850
- https://yaleman.org/post/2021/2021-01-01-apple-m1-terraform-and-golang/
将env varTFENV_ARCH
设置为arm64,然后使用tfenv
重新安装Terraform