【问题标题】:Terraform: using the vsphere provider in an offline windows environmentTerraform:在离线 Windows 环境中使用 vsphere 提供程序
【发布时间】: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 目录中并设置了我的环境变量。

  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)

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

正在初始化后端...

正在初始化提供程序插件... 查找匹配“~> 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

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

【问题讨论】:

    标签: terraform vsphere


    【解决方案1】:

    在下面关注 - https://www.terraform.io/upgrade-guides/0-14.html 在 cli 中使用 terraform :输入 terraform upgrade。

    【讨论】:

    • 或添加 terraform 版本 - version ="~> "1.25.0"
    • 感谢您的回复,但我不确定您指示我做什么?为什么我必须在哪里输入“terraform upgrade”?我添加了 tilda 箭头,但它什么也没做。 (对不起,我是新来使用 terraform)
    • 首先更新您的 main.tf 并在 CLI 中键入 terraform init
    猜你喜欢
    • 2020-10-17
    • 2020-12-13
    • 1970-01-01
    • 2018-08-03
    • 2021-09-18
    • 1970-01-01
    • 2020-07-21
    • 1970-01-01
    • 2021-12-26
    相关资源
    最近更新 更多