Using the vSphere provider, I’m trying to use Terraform to create a simple VM before moving onto something more complex.
In my case, my vCenter has 2 standalone hosts, no clusters. Each host is in their own datacenter. govc ls -l -i /Lab/host/vm-02.jaxon.ca/Resources
returns
ResourcePool:resgroup-6131 /Lab/host/vm-02.jaxon.ca/Resources
The error I’m getting is:
vsphere_virtual_machine.vm: Creating...
Error: could not find resource pool ID "data.vsphere_resource_pool.pool.id": ServerFaultCode: The object 'vim.ResourcePool:data.vsphere_resource_pool.pool.id' has already been deleted or has not been completely created
on vm-create.tf line 32, in resource "vsphere_virtual_machine" "vm":
32: resource "vsphere_virtual_machine" "vm" {
The relevant sections of my file are:
data "vsphere_resource_pool" "pool" {
name = "/Lab/host/vm-02.jaxon.ca/Resources"
datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
resource "vsphere_virtual_machine" "vm" {
name = "test-vm"
resource_pool_id = "data.vsphere_resource_pool.pool.id"
datastore_id = "data.vsphere_datastore.datastore.id"
I’ve tried all sorts of different things for the resource pool name, including just vm-02.jaxon.ca/Resources
but the error is all the same.
Hopefully I’m not missing something obvious but I’m pretty new at this so that is an option too.