W3cubDocs

/Terraform

vsphere_virtual_machine

The vsphere_virtual_machine data source can be used to find the UUID of an existing virtual machine or template. Its most relevant purpose is for finding the UUID of a template to be used as the source for cloning into a new vsphere_virtual_machine resource. It also reads the guest ID so that can be supplied as well.

Example Usage

data "vsphere_datacenter" "datacenter" {
  name = "dc1"
}

data "vsphere_virtual_machine" "template" {
  name          = "test-vm-template"
  datacenter_id = "${data.vsphere_datacenter.datacenter.id}"
}

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the virtual machine. This can be a name or path.
  • datacenter_id - (Optional) The managed object reference ID of the datacenter the virtual machine is located in. This can be omitted if the search path used in name is an absolute path. For default datacenters, use the id attribute from an empty vsphere_datacenter data source.
  • scsi_controller_scan_count - (Optional) The number of SCSI controllers to scan for disk attributes and controller types on. Default: 1.

Attribute Reference

The following attributes are exported:

  • id - The UUID of the virtual machine or template.
  • guest_id - The guest ID of the virtual machine or template.
  • alternate_guest_name - The alternate guest name of the virtual machine when guest_id is a non-specific operating system, like otherGuest.
  • scsi_type - The common type of all SCSI controllers on this virtual machine. Will be one of lsilogic (LSI Logic Parallel), lsilogic-sas (LSI Logic SAS), pvscsi (VMware Paravirtual), buslogic (BusLogic), or mixed when there are multiple controller types. Only the first number of controllers defined by scsi_controller_scan_count are scanned.
  • disks - Information about each of the disks on this virtual machine or template. These are sorted by bus and unit number so that they can be applied to a vsphere_virtual_machine resource in the order the resource expects while cloning. This is useful for discovering certain disk settings while performing a linked clone, as all settings that are output by this data source must be the same on the destination virtual machine as the source. Only the first number of controllers defined by scsi_controller_scan_count are scanned for disks. The sub-attributes are:
    • size - The size of the disk, in GIB.
    • eagerly_scrub - Set to true if the disk has been eager zeroed.
    • thin_provisioned - Set to true if the disk has been thin provisioned.
  • network_interface_types - The network interface types for each network interface found on the virtual machine, in device bus order. Will be one of e1000, e1000e, pcnet32, sriov, vmxnet2, or vmxnet3.
  • firmware - The firmware type for this virtual machine. Can be bios or efi.

© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/vsphere/d/virtual_machine.html