» vsphere_virtual_disk

The vsphere_virtual_disk resource can be used to create virtual disks outside of any given vsphere_virtual_machine resource. These disks can be attached to a virtual machine by creating a disk block with the attach parameter.

» Example Usage

resource "vsphere_virtual_disk" "myDisk" {
  size         = 2
  vmdk_path    = "myDisk.vmdk"
  datacenter   = "Datacenter"
  datastore    = "local"
  type         = "thin"
}

» Argument Reference

The following arguments are supported:

  • vmdk_path - (Required) The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
  • datastore - (Required) The name of the datastore in which to create the disk.
  • size - (Required) Size of the disk (in GB).
  • datacenter - (Optional) The name of the datacenter in which to create the disk. Can be omitted when when ESXi or if there is only one datacenter in your infrastructure.
  • type - (Optional) The type of disk to create. Can be one of eagerZeroedThick, lazy, or thin. Default: eagerZeroedThick. For information on what each kind of disk provisioning policy means, click here.

  • adapter_type - (Optional) The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

  • create_directories - (Optional) Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.