为什么 terraformer 找不到插件?

问题描述

我是 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 并重新初始化。

我的 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 将在该命令运行时给出输出,否则您可能认为什么都没有发生。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...