【发布时间】:2021-07-07 22:22:25
【问题描述】:
我想在无法访问互联网的 Windows 机器上使用 terraform vsphere 提供程序。我从here 下载了 terraform (v0.14.9),从here 下载了最新的 vsphere 提供程序 (v1.25.0),并将它们复制到离线机器上。但是,我不知道如何配置 Terraform,因此在调用 init、plan、apply 和 destroy 命令时它引用了我的离线 vsphere 提供程序。
我已将“terraform.exe”保存在 C:/tools 目录中并设置了我的环境变量。
- 我已尝试将 vsphere 提供程序保存到
C:/tools/terraform.d/plugins/registry.terraform.io/hashicorp/vsphere/terraform-provider-vsphere_v1.25.0_x4.exe并将以下内容添加到我的 tf 文件顶部:
terraform {
required_providers {
vsphere = {
source = "registry.terraform.io/hashicorp/vsphere"
version = "~> 1.25.0"
}
}
}
- 我尝试将它保存到任意文件夹 (
C:/tools/plugins/terraform-provider-vsphere_v1.25.0_x4.exe) 并在 init 命令中引用它:terraform init -input=false -plugin-dir=C:/tools/plugins)
尝试一次尝试连接到互联网(失败)并尝试第二次给出以下失败响应:
正在初始化后端...
正在初始化提供程序插件... 查找匹配“~> 1.25.0”的hashicorp/vsphere 版本...
错误:无法查询可用的提供程序包
无法检索提供者 hashcorp/vsphere 的可用版本列表:在任何搜索位置均未找到提供者 registry.terraform.io/hashicorp/vsphere
-C:/工具/插件
所以我扩展了 vsphere 插件的目录,如下所示:
C:/tools/plugins/registry.terraform.io/hashicorp/vsphere/terraform-provider-vsphere_v1.25.0_x4.exe
但它仍然不起作用并显示相同的错误消息?
【问题讨论】: