Terraform:在脱机windows环境中使用vsphere提供程序

Terraform:在脱机windows环境中使用vsphere提供程序,terraform,vsphere,Terraform,Vsphere,我想在无法访问internet的windows计算机上使用terraform vsphere提供程序。我已从和最新的vsphere提供程序(v1.25.0)下载terraform(v0.14.9),并将其复制到脱机机器。但是,我不知道如何配置Terraform,以便在调用init、plan、apply和destroy命令时,它引用我的脱机vsphere提供程序 我已将“terraform.exe”保存在C:/tools目录中,并设置了我的环境变量 我已尝试将vsphere提供程序保存到C:/to

我想在无法访问internet的windows计算机上使用terraform vsphere提供程序。我已从和最新的vsphere提供程序(v1.25.0)下载terraform(v0.14.9),并将其复制到脱机机器。但是,我不知道如何配置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文件的顶部:
  • 我已尝试将其保存到任意文件夹(
    C:/tools/plugins/terraform-provider-vsphere_v1.25.0_x4.exe
    )并在init命令中引用它:
    terraforminit-input=false-plugindir=C:/tools/plugins)
  • 尝试一尝试连接到internet(失败),尝试二给出以下失败响应:

    正在初始化后端

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

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

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

    -C:/tools/插件

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

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

    请参见以下内容-
    使用terraform在cli中使用:键入terraform upgrade。

    或添加terraform version-version=“~>”1.25.0”感谢您的回复,但我不确定您指示我做什么?为什么以及在哪里必须键入“terraform upgrade”?我添加了tilda箭头,但它没有做任何事情。(抱歉,我不熟悉使用terraform)首先更新main.tf并在CLI中键入terraform init
        terraform {
           required_providers {
               vsphere = {
                   source  = "registry.terraform.io/hashicorp/vsphere"
                   version = "~> 1.25.0"
                }
            }
         }