简体   繁体   中英

Terraform: using the vsphere provider in an offline windows environment

I want to use the terraform vsphere provider on a windows machine that cannot access the internet. I have downloaded terraform (v0.14.9) from here and the latest vsphere provider (v1.25.0) from here and copied these to the offline machine. However, I don't know how to then configure Terraform so it refers to my offline vsphere provider when calling init, plan, apply and destroy commands.

I have saved the "terraform.exe" in the C:/tools directory and setup my environment variables.

  1. I have tried saving the vsphere provider to C:/tools/terraform.d/plugins/registry.terraform.io/hashicorp/vsphere/terraform-provider-vsphere_v1.25.0_x4.exe and added the following to the top of my tf file:
    terraform {
       required_providers {
           vsphere = {
               source  = "registry.terraform.io/hashicorp/vsphere"
               version = "~> 1.25.0"
            }
        }
     }
  1. I have tried saving it to an arbitrary folder ( C:/tools/plugins/terraform-provider-vsphere_v1.25.0_x4.exe ) and referring to it in the init command: terraform init -input=false -plugin-dir=C:/tools/plugins)

Attempt one tries to connect to the internet (which fails) and attempt two gives the following fail response:

Initializing the backend...

Initializing provider plugins... Finding hashicorp/vsphere versions matching "~> 1.25.0"...

Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/vsphere: provider registry.terraform.io/hashicorp/vsphere was not found in any of the search locations

-C:/tools/plugins

So I expanded my directory for the vsphere plugin as follows: C:/tools/plugins/registry.terraform.io/hashicorp/vsphere/terraform-provider-vsphere_v1.25.0_x4.exe

But it still does not work and presents the same error message?

follow in bellow - https://www.terraform.io/upgrade-guides/0-14.html using in cli using terraform: type terraform upgrade.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM