当我在我的Apple Silicon macbook pro上为我的Google Cloud平台项目运行terraform init时,我得到了这个错误。
Provider registry.terraform.io/hashicorp/google v3.57.0 does not have a package available for your current platform, darwin_arm64.我该如何解决这个问题呢?我原以为Rosetta2仿真器会选中此框,但可惜...
发布于 2021-02-20 01:00:11
大多数提供商已经在较新版本中提供了包。您可以通过:terraform init -upgrade更新提供商,如果您不接受此路由,或者它不能解决问题,请查看下面的答案。
从头开始构建Terraform的GCP提供者!我修改了此演练。https://github.com/hashicorp/terraform/issues/27257#issuecomment-754777716
brew install --build-from-source terraform这也会安装Golang (在这篇文章中看起来还不错)
git clone https://github.com/hashicorp/terraform-provider-google.git
cd terraform-provider-google
git checkout v3.22.0
go get -d github.com/pavius/impi/cmd/impi
make tools
make build下面的目录可能还不存在,所以让我们创建它并复制我们刚刚构建的二进制文件。
mkdir -p ${HOME}/.terraform.d/plugins/registry.terraform.io/hashicorp/google/3.22.0/darwin_arm64
cp ${HOME}/go/bin/terraform-provider-google ${HOME}/.terraform.d/plugins/registry.terraform.io/hashicorp/google/3.22.0/darwin_arm64请注意,如果您还没有定义${GOPATH},那么您的golang安装将位于${HOME}/go。如果您这样做了,那么修改上面的命令来说明您的新构建二进制文件的位置。
cp ${GOPATH}/bin/terraform-provider-google ${HOME}/.terraform.d/plugins/registry.terraform.io/hashicorp/google/3.22.0/darwin_arm64回到我的项目之后,瞧!
➜ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding latest version of hashicorp/google...
- Installing hashicorp/google v3.22.0...
- Installed hashicorp/google v3.22.0 (unauthenticated)
Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, otherhttps://stackoverflow.com/questions/66281882
复制相似问题