Terraform:在离线窗口环境中使用vsphere提供程序



我想在无法访问互联网的windows机器上使用terraform vsphere提供程序。我已经从这里下载了terraform(v0.14.9(和最新的vsphere提供商(v1.25.0(,并将它们复制到离线机器上。然而,我不知道如何配置Terraform,所以在调用init、plan、application和destroy命令时,它引用了我的离线vsphere提供程序。

我保存了";terraform.exe";在C:\/tools目录中,并设置我的环境变量。

  1. 我尝试将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"
}
}
}
  1. 我尝试将它保存到任意文件夹(C:/tools/plugins/terraform-provider-vsphere_v1.25.0_x4.exe(中,并在init命令中引用它:terraform init -input=false -plugin-dir=C:/tools/plugins)

尝试一次尝试连接到互联网(失败(,尝试二次会给出以下失败响应:

正在初始化后端。。。

正在初始化提供程序插件。。。查找匹配"hashicorp/vsphere"的版本~>1.25.0〃;。。。

错误:无法查询可用的提供商包

无法检索提供程序hashicorp/vsphere的可用版本列表:在的任何搜索位置都找不到提供程序registry.terraform.io/hashicorp/vsphere

-C:/tools/plugins

所以我扩展了vsphere插件的目录,如下所示:C:/tools/plugins/registry.terraform.io/hashicorp/vsphere/terraform-provider-vsphere_v1.25.0_x4.exe

但它仍然不起作用,并显示相同的错误消息?

如下所示-https://www.terraform.io/upgrade-guides/0-14.html在cli using terraform中使用:键入terraform upgrade。

最新更新