Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

VirtualDisk

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

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var myDisk = new VSphere.VirtualDisk("myDisk", new VSphere.VirtualDiskArgs
        {
            Datacenter = "Datacenter",
            Datastore = "local",
            Size = 2,
            Type = "thin",
            VmdkPath = "myDisk.vmdk",
        });
    }

}
package main

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

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := vsphere.NewVirtualDisk(ctx, "myDisk", &vsphere.VirtualDiskArgs{
            Datacenter: pulumi.String("Datacenter"),
            Datastore:  pulumi.String("local"),
            Size:       pulumi.Int(2),
            Type:       pulumi.String("thin"),
            VmdkPath:   pulumi.String("myDisk.vmdk"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

my_disk = vsphere.VirtualDisk("myDisk",
    datacenter="Datacenter",
    datastore="local",
    size=2,
    type="thin",
    vmdk_path="myDisk.vmdk")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const myDisk = new vsphere.VirtualDisk("myDisk", {
    datacenter: "Datacenter",
    datastore: "local",
    size: 2,
    type: "thin",
    vmdkPath: "myDisk.vmdk",
});

Create a VirtualDisk Resource

new VirtualDisk(name: string, args: VirtualDiskArgs, opts?: CustomResourceOptions);
def VirtualDisk(resource_name: 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)
func NewVirtualDisk(ctx *Context, name string, args VirtualDiskArgs, opts ...ResourceOption) (*VirtualDisk, error)
public VirtualDisk(string name, VirtualDiskArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args VirtualDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args VirtualDiskArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VirtualDiskArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

VirtualDisk Resource Properties

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

Inputs

The VirtualDisk resource accepts the following input properties:

Datastore string

The name of the datastore in which to create the disk.

Size int

Size of the disk (in GB).

VmdkPath string

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

AdapterType string

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

CreateDirectories bool

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

Datacenter string

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 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][docs-vmware-vm-disk-provisioning].

Datastore string

The name of the datastore in which to create the disk.

Size int

Size of the disk (in GB).

VmdkPath string

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

AdapterType string

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

CreateDirectories bool

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

Datacenter string

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 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][docs-vmware-vm-disk-provisioning].

datastore string

The name of the datastore in which to create the disk.

size number

Size of the disk (in GB).

vmdkPath string

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

adapterType string

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

createDirectories boolean

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

datacenter string

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 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][docs-vmware-vm-disk-provisioning].

datastore str

The name of the datastore in which to create the disk.

size int

Size of the disk (in GB).

vmdk_path str

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

adapter_type str

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

create_directories bool

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

datacenter str

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 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][docs-vmware-vm-disk-provisioning].

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 str
The provider-assigned unique ID for this managed resource.

Look up an 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)
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
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
The unique name of the resulting resource.
id
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 string

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

CreateDirectories bool

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

Datacenter string

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.

Datastore string

The name of the datastore in which to create the disk.

Size int

Size of the disk (in GB).

Type 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][docs-vmware-vm-disk-provisioning].

VmdkPath string

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

AdapterType string

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

CreateDirectories bool

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

Datacenter string

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.

Datastore string

The name of the datastore in which to create the disk.

Size int

Size of the disk (in GB).

Type 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][docs-vmware-vm-disk-provisioning].

VmdkPath string

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

adapterType string

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

createDirectories boolean

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

datacenter string

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.

datastore string

The name of the datastore in which to create the disk.

size number

Size of the disk (in GB).

type 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][docs-vmware-vm-disk-provisioning].

vmdkPath string

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

adapter_type str

The adapter type for this virtual disk. Can be one of ide, lsiLogic, or busLogic. Default: lsiLogic.

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

create_directories bool

Tells the resource to create any directories that are a part of the vmdk_path parameter if they are missing. Default: false.

datacenter str

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.

datastore str

The name of the datastore in which to create the disk.

size int

Size of the disk (in GB).

type 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][docs-vmware-vm-disk-provisioning].

vmdk_path str

The path, including filename, of the virtual disk to be created. This needs to end in .vmdk.

Package Details

Repository
https://github.com/pulumi/pulumi-vsphere
License
Apache-2.0
Notes
This Pulumi package is based on the vsphere Terraform Provider.