为什么';t Terraform是否可以查看手动安装的提供商?

为什么';t Terraform是否可以查看手动安装的提供商?,terraform,rancher,rke,Terraform,Rancher,Rke,我正在尝试将安装作为的一部分。上面说插件应该安装在~/.terraform.d/plugins。RKE文档说明插件应该安装在~/terraform.d/plugins/上 为了协调冲突信息,我尝试将二进制文件复制到以下所有位置,但Terraform从未看到任何位置: ~/.terraform.d/plugins/terraform-provider-rke ~/.terraform.d/plugins/rke ~/.terraform.d/plugins/darwin_amd64/terrafo

我正在尝试将安装作为的一部分。上面说插件应该安装在
~/.terraform.d/plugins
。RKE文档说明插件应该安装在
~/terraform.d/plugins/

为了协调冲突信息,我尝试将二进制文件复制到以下所有位置,但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
最后,我可以使用
terraforminit-plugindir=
。但是Terraform没有看到任何自动下载的插件,我必须手动安装所有插件


是否有某个路径变量丢失,或者我未能遵循的其他命名约定?

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

根据,提供者需要命名为
地形提供者-vX.Y.Z
。该文件称应称为
地形提供商rke
(无版本号)

在a中,它表示支持这种无版本格式以实现反向兼容性。但是,Terraform将该版本解释为
v0.0.0

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

Error: provider.rke: no suitable version installed
  version requirements: "0.14.1"
  versions installed: "0.0.0"
该版本可能是另一个依赖于RKE提供商的提供商的要求

我回去从Github repo手动下载了这个版本,并将其复制到插件目录中,名为
terraform-provider-rke_v0.14.1
。成功了


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

适用于公司防火墙上的Windows用户,不允许直接下载提供商zip文件。

  • 只需访问相应的URL下载提供商ZIP文件
    • 父URL:
    • AWS-URL:

    • 现在,在根目录-main.tf文件中,其中包含providers部分
  • 创建类似registry.terraform.io\hashicorp\aws\3.37.0\windows\u amd64的文件夹结构,并将从上面的zip提取的exe文件放置在此位置
  • 转到命令行并运行:
  • terraforminit-plugindir


    目录结构:

    • main.tf
    • registry.terraform.io\hashicorp\aws\3.37.0\windows\u amd64\terraform\u provider\u aws\u v3.37.0\u x5.exe

    aws_v3.37.0_x5.exe

    尝试构建提供商:为什么这会改变结果?您是自己构建的,如果您的环境中存在任何问题,它可能会显示这种方式我自己构建了它,但它没有解决问题,但这帮助我缩小了范围,这让我能够找到答案(请参阅我的答案)。非常感谢。