0
votes

I read documentation https://registry.terraform.io/providers/hashicorp/vsphere/latest/docs/resources/virtual_machine#using-vapp-properties-to-supply-ovf-ova-configuration and few tutorials about cloning machine from an OVF/OVA-created template with vApp properties and I always read about local path to ovf template or they just put name of template in variables and that works like there https://blog.inkubate.io/create-a-centos-7-terraform-template-for-vmware-vsphere/. Where Terraform search for template? What if I have template in some datastore? What should I write in this part of my file?

data "vsphere_datastore" "datastore" {
  name          = "my_best_datastore"
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_virtual_machine" "template_from_ovf" {
  name          = "template_from_ovf"  ---what should be there? Path like /dc/datastore/somefile or only name?
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}
1

1 Answers

0
votes

The VM data source object is looking for the name of the template as it shows through either the UI or the API as well as the datacenter ID it resides in. That means that the template must be registered to the vSphere environment and that it cannot search datastores for the desired OVA/OVF files.

More info on what the vsphere-virtual-machine data source can be found: here