Search code examples
terraformterraform-provider-vsphere

terraform init vsphere provider - Failed to query available provider packages vmsphere


terraform v1.0.3 installed via brew on Mac OS

It's my first time using Terraform with a "vshpere" provider. When I do a terraform init on my plan, I get the following error.

provider "vsphere" {
  user           = var.vsphere_user
  password       = var.vsphere_password
  vsphere_server = var.vsphere_server
}

module "exa_v30_01" {
  source           = "../modules/vm"
  vsphere_user     = var.vsphere_user
  vsphere_password = var.vsphere_password
  template_name    = var.template_name
  vm_name          = var.vm_name
}

$ terraform init
Initializing modules...

Initializing the backend...

Initializing provider plugins...
- Finding latest version of hashicorp/vsphere...
- Finding latest version of hashicorp/vmsphere...
- Installing hashicorp/vsphere v2.0.2...
- Installed hashicorp/vsphere v2.0.2 (signed by HashiCorp)
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider
│ hashicorp/vmsphere: provider registry registry.terraform.io does
│ not have a provider named registry.terraform.io/hashicorp/vmsphere
│ 
│ All modules should specify their required_providers so that
│ external consumers will get the correct providers when using a
│ module. To see which modules are currently depending on
│ hashicorp/vmsphere, run the following command:
│     terraform providers
╵

$ terraform providers

Providers required by configuration:
.
├── provider[registry.terraform.io/hashicorp/vsphere]
└── module.exa_v30_01
    ├── provider[registry.terraform.io/hashicorp/vsphere]
    └── provider[registry.terraform.io/hashicorp/vmsphere]

How do I solve this? I googled and searched here, but nothing relating to VSphpere. Any clues? Thanks

UPDATE:

I see Force Terraform to install providers from local disk only, disabling Terraform Registry, but that's for a terraform version upgrade.


Solution

  • The error message is correct. There is not provider called vmsphere. Maybe you wanted vsphere provider? Your module exa_v30_01 seems to be using wrong providers somewhere.