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 sub-resource with the attach
parameter.
resource "vsphere_virtual_disk" "myDisk" { size = 2 vmdk_path = "myDisk.vmdk" datacenter = "Datacenter" datastore = "local" type = "thin" }
The following arguments are supported:
NOTE: All fields in the
vsphere_virtual_disk
resource are currently immutable and force a new resource if changed.
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
.
NOTE:
adapter_type
is deprecated: it does not dictate the type of controller that the virtual disk will be attached to on the virtual machine. Please see thescsi_type
parameter in thevsphere_virtual_machine
resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.
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
. NOTE: Any directory created as part of the operation when
create_directories
is enabled will not be deleted when the resource is destroyed.
© 2018 HashiCorpLicensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/vsphere/r/virtual_disk.html