Terraform v0.13.0
...
``` main.tf
terraform {
required_providers {
vsphere = {
source = "hashicorp/vsphere"
version = "1.22.0"
}
}
}
...
resource "vsphere_virtual_machine" "vm" {
name = var.vm_name
resource_pool_id = "${data.vsphere_compute_cluster.cluster.resource_pool_id}"
datastore_cluster_id = "${data.vsphere_datastore_cluster.datastore_cluster.id}"
#datastore_id = var.vsphere_datastore
num_cpus = var.vm_cpu
memory = var.vm_memory
guest_id = "${data.vsphere_virtual_machine.template.guest_id}"
scsi_type = "${data.vsphere_virtual_machine.template.scsi_type}"
network_interface {
network_id = "${data.vsphere_network.network.id}"
adapter_type = "${data.vsphere_virtual_machine.template.network_interface_types[0]}"
}
...
### Debug Output
<!--
Full debug output can be obtained by running Terraform with the environment variable `TF_LOG=trace`. Please create a GitHub Gist containing the debug output. Please do _not_ paste the debug output in the issue, since debug output is long.
Debug output may contain sensitive information. Please review it before posting publicly, and if you are concerned feel free to encrypt the files using the HashiCorp security public key.
-->
### Crash Output
<!--
If the console output indicates that Terraform crashed, please share a link to a GitHub Gist containing the output of the `crash.log` file.
-->
$ terraform refresh -lock=false -var-file=$ENV.tfvar -state=/mnt/$ENV/os.tfstate
Error: Could not load plugin
Plugin reinitialization required. Please run "terraform init".
Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.
Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints, run "terraform providers".
Failed to instantiate provider "registry.terraform.io/-/vsphere" to obtain
schema: unknown provider "registry.terraform.io/-/vsphere"
ERROR: Job failed: exit code 1
```
Terraform reports init succeeded
Then reports that the vsphere plugin cannot be found
terraform initterraform refreshThis looks like you have resources in state which are using the legacy provider name. Once your configuration is fixed, you'll need to run terraform apply to upgrade your state file.
For this upgrade in particular, completing the upgrade will require running
terraform applywith Terraform 0.13 after upgrading in order to apply some upgrades to the Terraform state, and we recommend doing that with no other changes pending.
Can you try this and report back?
Hi @alisdair
Yes, erasing the .tfstate and running my whole pipeline again fixed my issue.
Thanks!
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.