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.
- 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 my tf file:
terraform {
required_providers {
vsphere = {
source = "registry.terraform.io/hashicorp/vsphere"
version = "~> 1.25.0"
}
}
}
- I have tried saving the vsphere provider 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 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 Terraform Registry 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 presents the same error message?