为什么 Terraform 看不到我手动安装的提供程序?

Dav*_*ein 4 terraform rancher rke

我正在尝试将RKE 提供程序安装为Rancher AWS 快速入门的一部分。该Terraform文件说,插件应该安装~/.terraform.d/plugins。RKE 文档说插件应该安装在~/terraform.d/plugins/<your_platform>.

为了协调冲突的信息,我尝试将二进制文件复制到以下所有位置,但 Terraform 从未见过其中任何一个:

~/.terraform.d/plugins/terraform-provider-rke
~/.terraform.d/plugins/rke
~/.terraform.d/plugins/darwin_amd64/terraform-provider-rke
~/.terraform.d/plugins/darwin_amd64/rke
~/terraform.d/plugins/terraform-provider-rke
~/terraform.d/plugins/rke
~/terraform.d/plugins/darwin_amd64/terraform-provider-rke
~/terraform.d/plugins/darwin_amd64/rke
Run Code Online (Sandbox Code Playgroud)

在每种情况下,当我运行时terraform init,都会出现以下错误:

Provider "rke" not available for installation.

A provider named "rke" could not be found in the Terraform Registry.

This may result from mistyping the provider name, or the given provider may
be a third-party provider that cannot be installed automatically.

In the latter case, the plugin must be installed manually by locating and
downloading a suitable distribution package and placing the plugin's executable
file in the following directory:
    terraform.d/plugins/darwin_amd64

Terraform detects necessary plugins by inspecting the configuration and state.
To view the provider versions requested by each module, run
"terraform providers".


Error: no provider exists with the given name
Run Code Online (Sandbox Code Playgroud)

作为最后的手段,我可​​以使用terraform init -plugin-dir=<something>. 但是随后 Terraform 没有看到任何自动下载的插件,我必须手动安装所有插件。

是否缺少某些路径变量,或者我未能遵循的其他命名约定?

Dav*_*ein 7

事实证明,错误消息并没有说明全部情况。Terraform 正在寻找提供者,但它认为它不是一个足够新的版本。

根据Terraform 的文档,提供程序需要命名为terraform-provider-<NAME>_vX.Y.Z. RKE 提供程序文档说应该调用该文件terraform-provider-rke(无版本号)。

用于插件发现的 Terraform 源代码注释中,它表示支持这种无版本格式以实现反向兼容性。但是,Terraform 将版本解释为v0.0.0.

当我terraform plan在 failed 之后运行时terraform init,它给了我一条信息更丰富的错误消息:

Error: provider.rke: no suitable version installed
  version requirements: "0.14.1"
  versions installed: "0.0.0"
Run Code Online (Sandbox Code Playgroud)

该版本可能是另一个依赖于 RKE 提供者的提供者的要求。

我返回并从 Github 存储库手动下载该确切版本,并将其复制到名为terraform-provider-rke_v0.14.1. 有效!

所以你去。如有疑问,请查看源代码。现在向 Rancher 提交问题报告,告诉他们更新文档。:-)