1. Packages
  2. Vsphere Provider
  3. API Docs
  4. VirtualDisk
vSphere v4.13.2 published on Wednesday, Apr 9, 2025 by Pulumi

vsphere.VirtualDisk

Explore with Pulumi AI

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

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const datacenter = vsphere.getDatacenter({
    name: "dc-01",
});
const datastore = vsphere.getDatacenter({
    name: "datastore-01",
});
const virtualDisk = new vsphere.VirtualDisk("virtual_disk", {
    size: 40,
    type: "thin",
    vmdkPath: "/foo/foo.vmdk",
    createDirectories: true,
    datacenter: datacenter.then(datacenter => datacenter.name),
    datastore: datastoreVsphereDatastore.name,
});
Copy
import pulumi
import pulumi_vsphere as vsphere

datacenter = vsphere.get_datacenter(name="dc-01")
datastore = vsphere.get_datacenter(name="datastore-01")
virtual_disk = vsphere.VirtualDisk("virtual_disk",
    size=40,
    type="thin",
    vmdk_path="/foo/foo.vmdk",
    create_directories=True,
    datacenter=datacenter.name,
    datastore=datastore_vsphere_datastore["name"])
Copy
package main

import (
	"github.com/pulumi/pulumi-vsphere/sdk/v4/go/vsphere"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		datacenter, err := vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
			Name: pulumi.StringRef("dc-01"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.LookupDatacenter(ctx, &vsphere.LookupDatacenterArgs{
			Name: pulumi.StringRef("datastore-01"),
		}, nil)
		if err != nil {
			return err
		}
		_, err = vsphere.NewVirtualDisk(ctx, "virtual_disk", &vsphere.VirtualDiskArgs{
			Size:              pulumi.Int(40),
			Type:              pulumi.String("thin"),
			VmdkPath:          pulumi.String("/foo/foo.vmdk"),
			CreateDirectories: pulumi.Bool(true),
			Datacenter:        pulumi.String(datacenter.Name),
			Datastore:         pulumi.Any(datastoreVsphereDatastore.Name),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using VSphere = Pulumi.VSphere;

return await Deployment.RunAsync(() => 
{
    var datacenter = VSphere.GetDatacenter.Invoke(new()
    {
        Name = "dc-01",
    });

    var datastore = VSphere.GetDatacenter.Invoke(new()
    {
        Name = "datastore-01",
    });

    var virtualDisk = new VSphere.VirtualDisk("virtual_disk", new()
    {
        Size = 40,
        Type = "thin",
        VmdkPath = "/foo/foo.vmdk",
        CreateDirectories = true,
        Datacenter = datacenter.Apply(getDatacenterResult => getDatacenterResult.Name),
        Datastore = datastoreVsphereDatastore.Name,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vsphere.VsphereFunctions;
import com.pulumi.vsphere.inputs.GetDatacenterArgs;
import com.pulumi.vsphere.VirtualDisk;
import com.pulumi.vsphere.VirtualDiskArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var datacenter = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
            .name("dc-01")
            .build());

        final var datastore = VsphereFunctions.getDatacenter(GetDatacenterArgs.builder()
            .name("datastore-01")
            .build());

        var virtualDisk = new VirtualDisk("virtualDisk", VirtualDiskArgs.builder()
            .size(40)
            .type("thin")
            .vmdkPath("/foo/foo.vmdk")
            .createDirectories(true)
            .datacenter(datacenter.name())
            .datastore(datastoreVsphereDatastore.name())
            .build());

    }
}
Copy
resources:
  virtualDisk:
    type: vsphere:VirtualDisk
    name: virtual_disk
    properties:
      size: 40
      type: thin
      vmdkPath: /foo/foo.vmdk
      createDirectories: true
      datacenter: ${datacenter.name}
      datastore: ${datastoreVsphereDatastore.name}
variables:
  datacenter:
    fn::invoke:
      function: vsphere:getDatacenter
      arguments:
        name: dc-01
  datastore:
    fn::invoke:
      function: vsphere:getDatacenter
      arguments:
        name: datastore-01
Copy

Create VirtualDisk Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new VirtualDisk(name: string, args: VirtualDiskArgs, opts?: CustomResourceOptions);
@overload
def VirtualDisk(resource_name: str,
                args: VirtualDiskArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def VirtualDisk(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                datastore: Optional[str] = None,
                size: Optional[int] = None,
                vmdk_path: Optional[str] = None,
                adapter_type: Optional[str] = None,
                create_directories: Optional[bool] = None,
                datacenter: Optional[str] = None,
                type: Optional[str] = None)
func NewVirtualDisk(ctx *Context, name string, args VirtualDiskArgs, opts ...ResourceOption) (*VirtualDisk, error)
public VirtualDisk(string name, VirtualDiskArgs args, CustomResourceOptions? opts = null)
public VirtualDisk(String name, VirtualDiskArgs args)
public VirtualDisk(String name, VirtualDiskArgs args, CustomResourceOptions options)
type: vsphere:VirtualDisk
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. VirtualDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. VirtualDiskArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. VirtualDiskArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. VirtualDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. VirtualDiskArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var virtualDiskResource = new VSphere.VirtualDisk("virtualDiskResource", new()
{
    Datastore = "string",
    Size = 0,
    VmdkPath = "string",
    CreateDirectories = false,
    Datacenter = "string",
    Type = "string",
});
Copy
example, err := vsphere.NewVirtualDisk(ctx, "virtualDiskResource", &vsphere.VirtualDiskArgs{
	Datastore:         pulumi.String("string"),
	Size:              pulumi.Int(0),
	VmdkPath:          pulumi.String("string"),
	CreateDirectories: pulumi.Bool(false),
	Datacenter:        pulumi.String("string"),
	Type:              pulumi.String("string"),
})
Copy
var virtualDiskResource = new VirtualDisk("virtualDiskResource", VirtualDiskArgs.builder()
    .datastore("string")
    .size(0)
    .vmdkPath("string")
    .createDirectories(false)
    .datacenter("string")
    .type("string")
    .build());
Copy
virtual_disk_resource = vsphere.VirtualDisk("virtualDiskResource",
    datastore="string",
    size=0,
    vmdk_path="string",
    create_directories=False,
    datacenter="string",
    type="string")
Copy
const virtualDiskResource = new vsphere.VirtualDisk("virtualDiskResource", {
    datastore: "string",
    size: 0,
    vmdkPath: "string",
    createDirectories: false,
    datacenter: "string",
    type: "string",
});
Copy
type: vsphere:VirtualDisk
properties:
    createDirectories: false
    datacenter: string
    datastore: string
    size: 0
    type: string
    vmdkPath: string
Copy

VirtualDisk Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The VirtualDisk resource accepts the following input properties:

Datastore
This property is required.
Changes to this property will trigger replacement.
string
The name of the datastore in which to create the disk.
Size This property is required. int
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
VmdkPath
This property is required.
Changes to this property will trigger replacement.
string
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
AdapterType Changes to this property will trigger replacement. string

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

CreateDirectories Changes to this property will trigger replacement. bool

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.

Datacenter Changes to this property will trigger replacement. string
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
Type Changes to this property will trigger replacement. string
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.
Datastore
This property is required.
Changes to this property will trigger replacement.
string
The name of the datastore in which to create the disk.
Size This property is required. int
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
VmdkPath
This property is required.
Changes to this property will trigger replacement.
string
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
AdapterType Changes to this property will trigger replacement. string

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

CreateDirectories Changes to this property will trigger replacement. bool

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.

Datacenter Changes to this property will trigger replacement. string
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
Type Changes to this property will trigger replacement. string
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.
datastore
This property is required.
Changes to this property will trigger replacement.
String
The name of the datastore in which to create the disk.
size This property is required. Integer
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
vmdkPath
This property is required.
Changes to this property will trigger replacement.
String
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapterType Changes to this property will trigger replacement. String

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

createDirectories Changes to this property will trigger replacement. Boolean

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.

datacenter Changes to this property will trigger replacement. String
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
type Changes to this property will trigger replacement. String
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.
datastore
This property is required.
Changes to this property will trigger replacement.
string
The name of the datastore in which to create the disk.
size This property is required. number
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
vmdkPath
This property is required.
Changes to this property will trigger replacement.
string
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapterType Changes to this property will trigger replacement. string

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

createDirectories Changes to this property will trigger replacement. boolean

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.

datacenter Changes to this property will trigger replacement. string
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
type Changes to this property will trigger replacement. string
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.
datastore
This property is required.
Changes to this property will trigger replacement.
str
The name of the datastore in which to create the disk.
size This property is required. int
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
vmdk_path
This property is required.
Changes to this property will trigger replacement.
str
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapter_type Changes to this property will trigger replacement. str

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

create_directories Changes to this property will trigger replacement. bool

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.

datacenter Changes to this property will trigger replacement. str
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
type Changes to this property will trigger replacement. str
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.
datastore
This property is required.
Changes to this property will trigger replacement.
String
The name of the datastore in which to create the disk.
size This property is required. Number
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
vmdkPath
This property is required.
Changes to this property will trigger replacement.
String
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapterType Changes to this property will trigger replacement. String

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

createDirectories Changes to this property will trigger replacement. Boolean

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.

datacenter Changes to this property will trigger replacement. String
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
type Changes to this property will trigger replacement. String
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.

Outputs

All input properties are implicitly available as output properties. Additionally, the VirtualDisk resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing VirtualDisk Resource

Get an existing VirtualDisk resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: VirtualDiskState, opts?: CustomResourceOptions): VirtualDisk
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        adapter_type: Optional[str] = None,
        create_directories: Optional[bool] = None,
        datacenter: Optional[str] = None,
        datastore: Optional[str] = None,
        size: Optional[int] = None,
        type: Optional[str] = None,
        vmdk_path: Optional[str] = None) -> VirtualDisk
func GetVirtualDisk(ctx *Context, name string, id IDInput, state *VirtualDiskState, opts ...ResourceOption) (*VirtualDisk, error)
public static VirtualDisk Get(string name, Input<string> id, VirtualDiskState? state, CustomResourceOptions? opts = null)
public static VirtualDisk get(String name, Output<String> id, VirtualDiskState state, CustomResourceOptions options)
resources:  _:    type: vsphere:VirtualDisk    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
AdapterType Changes to this property will trigger replacement. string

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

CreateDirectories Changes to this property will trigger replacement. bool

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.

Datacenter Changes to this property will trigger replacement. string
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
Datastore Changes to this property will trigger replacement. string
The name of the datastore in which to create the disk.
Size int
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
Type Changes to this property will trigger replacement. string
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.
VmdkPath Changes to this property will trigger replacement. string
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
AdapterType Changes to this property will trigger replacement. string

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

CreateDirectories Changes to this property will trigger replacement. bool

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.

Datacenter Changes to this property will trigger replacement. string
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
Datastore Changes to this property will trigger replacement. string
The name of the datastore in which to create the disk.
Size int
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
Type Changes to this property will trigger replacement. string
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.
VmdkPath Changes to this property will trigger replacement. string
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapterType Changes to this property will trigger replacement. String

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

createDirectories Changes to this property will trigger replacement. Boolean

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.

datacenter Changes to this property will trigger replacement. String
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
datastore Changes to this property will trigger replacement. String
The name of the datastore in which to create the disk.
size Integer
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
type Changes to this property will trigger replacement. String
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.
vmdkPath Changes to this property will trigger replacement. String
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapterType Changes to this property will trigger replacement. string

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

createDirectories Changes to this property will trigger replacement. boolean

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.

datacenter Changes to this property will trigger replacement. string
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
datastore Changes to this property will trigger replacement. string
The name of the datastore in which to create the disk.
size number
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
type Changes to this property will trigger replacement. string
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.
vmdkPath Changes to this property will trigger replacement. string
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapter_type Changes to this property will trigger replacement. str

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

create_directories Changes to this property will trigger replacement. bool

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.

datacenter Changes to this property will trigger replacement. str
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
datastore Changes to this property will trigger replacement. str
The name of the datastore in which to create the disk.
size int
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
type Changes to this property will trigger replacement. str
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.
vmdk_path Changes to this property will trigger replacement. str
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.
adapterType Changes to this property will trigger replacement. String

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 the scsi_type parameter in the vsphere.VirtualMachine resource for information on how to control disk controller types. This parameter will be removed in future versions of the vSphere provider.

Deprecated: this attribute has no effect on controller types - please use scsi_type in vsphere.VirtualMachine instead

createDirectories Changes to this property will trigger replacement. Boolean

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.

datacenter Changes to this property will trigger replacement. String
The name of the datacenter in which to create the disk. Can be omitted when ESXi or if there is only one datacenter in your infrastructure.
datastore Changes to this property will trigger replacement. String
The name of the datastore in which to create the disk.
size Number
Size of the disk (in GB). Decreasing the size of a disk is not possible. If a disk of a smaller size is required then the original has to be destroyed along with its data and a new one has to be created.
type Changes to this property will trigger replacement. String
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.
vmdkPath Changes to this property will trigger replacement. String
The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

Import

An existing virtual disk can be imported into this resource

via supplying the full datastore path to the virtual disk. An example is below:

$ pulumi import vsphere:index/virtualDisk:VirtualDisk virtual_disk \
Copy

‘{“virtual_disk_path”: “/dc-01/[datastore-01]foo/bar.vmdk”, \ “create_directories”: “true”}’

The above would import the virtual disk located at foo/bar.vmdk in the datastore-01

datastore of the dc-01 datacenter with create_directories set as true.

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
vSphere pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.