为什么 terraformer 找不到插件?

Why does terraformer not find plugin?

我是 Terraform 世界的新手。我正在尝试在 GCP 项目上使用 terraformer,但一直找不到插件:

terraformer import google --resources=gcs,forwardingRules,httpHealthChecks --connect=true --
regions=europe-west1,europe-west4 --projects=myproj
2021/02/12 08:17:03 google importing project myproj region europe-west1
2021/02/12 08:17:04 google importing... gcs
2021/02/12 08:17:05 open \.terraform.d/plugins/windows_amd64: The system cannot find the path specified.

在上述之前,这样安装了 terraformer:choco install terraformer 我下载了 Google 提供程序,terraform-provider-google_v3.56.0_x5.exe,将它放在我的 terraform 目录中,然后 terraform init。我检查了 %AppData\Roaming\terraform.d\plugins\windows_amd64 并且 plugins\windows_amd64 不存在,所以我创建了它,放入 Google exe 并重新编写了 init.

我的 main.tf 是:

provider "google" {
 project = "{myproj"
  region  = "europe-west2"
  zone    = "europe-west2-a"
}

会不会是巧克力安装导致了这个问题?我以前从未使用过它,但替代安装看起来令人生畏!

令人生畏的指令奏效了!

Run git clone <terraformer repo>
Run go mod download
Run go build -v for all providers OR build with one provider go run build/main.go {google,aws,azure,kubernetes and etc}
Run terraform init against an versions.tf file to install the plugins required for your platform. For example, if you need plugins for the google provider, versions.tf should contain:
terraform {
  required_providers {
    google = {
      source = "hashicorp/google"
    }
  }
  required_version = ">= 0.13"
}

确保运行那个版本而不是巧克力版本。

go mod download 标志 -x 将在该命令 运行s 时给出输出,否则你可能认为什么都没有发生。

如果您从 Chocolatey 安装,它似乎会在 C:\.terraform.d\plugins\windows_amd64 寻找提供程序文件。如果您创建这些目录并将 terraform-provider-xxx.exe 文件放入其中,它将被拾取。

我还建议 运行 它带有 --verbose 标志。