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

问题描述 投票:0回答:1

我正在尝试将RKE provider安装为Rancher AWS quickstart的一部分。 Terraform documentation表示插件应安装在~/.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

在每种情况下,当我运行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

作为最后的选择,我可以使用terraform init -plugin-dir=<something>。但是随后Terraform看不到任何自动下载的插件,因此我必须手动安装所有内容。

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

terraform rancher rke
1个回答
0
投票

事实是错误消息并没有说明全部。 Terraform正在查找提供程序,但它认为这不是一个足够新的版本。

根据Terraform's documentation,提供者需要命名为terraform-provider-<NAME>_vX.Y.Zdocumentation for the RKE provider表示该文件应名为terraform-provider-rke(无版本号)。

comment in the Terraform source code for plugin discovery中,它表示此无版本格式受支持以实现反向兼容性。但是,Terraform会将版本解释为v0.0.0

当我在失败的terraform plan之后运行terraform init时,它给了我更多有用的错误消息:

Error: provider.rke: no suitable version installed
  version requirements: "0.14.1"
  versions installed: "0.0.0"

该版本可能是来自另一个依赖RKE提供程序的提供程序的要求。

我回去并从Github存储库中手动下载了确切的版本,并将其复制到名称为terraform-provider-rke_v0.14.1的插件目录中。成功了!

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

© www.soinside.com 2019 - 2024. All rights reserved.