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

VirtualMachineSnapshot

The vsphere.VirtualMachineSnapshot resource can be used to manage snapshots for a virtual machine.

For more information on managing snapshots and how they work in VMware, see here.

NOTE: A snapshot in VMware differs from traditional disk snapshots, and can contain the actual running state of the virtual machine, data for all disks that have not been set to be independent from the snapshot (including ones that have been attached via the attach parameter to the vsphere.VirtualMachine disk block), and even the configuration of the virtual machine at the time of the snapshot. Virtual machine, disk activity, and configuration changes post-snapshot are not included in the original state. Use this resource with care! Neither VMware nor HashiCorp recommends retaining snapshots for a extended period of time and does NOT recommend using them as as backup feature. For more information on the limitation of virtual machine snapshots, see here.

Example Usage

using Pulumi;
using VSphere = Pulumi.VSphere;

class MyStack : Stack
{
    public MyStack()
    {
        var demo1 = new VSphere.VirtualMachineSnapshot("demo1", new VSphere.VirtualMachineSnapshotArgs
        {
            Consolidate = true,
            Description = "This is Demo Snapshot",
            Memory = true,
            Quiesce = true,
            RemoveChildren = false,
            SnapshotName = "Snapshot Name",
            VirtualMachineUuid = "9aac5551-a351-4158-8c5c-15a71e8ec5c9",
        });
    }

}
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.NewVirtualMachineSnapshot(ctx, "demo1", &vsphere.VirtualMachineSnapshotArgs{
            Consolidate:        pulumi.Bool(true),
            Description:        pulumi.String("This is Demo Snapshot"),
            Memory:             pulumi.Bool(true),
            Quiesce:            pulumi.Bool(true),
            RemoveChildren:     pulumi.Bool(false),
            SnapshotName:       pulumi.String("Snapshot Name"),
            VirtualMachineUuid: pulumi.String("9aac5551-a351-4158-8c5c-15a71e8ec5c9"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_vsphere as vsphere

demo1 = vsphere.VirtualMachineSnapshot("demo1",
    consolidate=True,
    description="This is Demo Snapshot",
    memory=True,
    quiesce=True,
    remove_children=False,
    snapshot_name="Snapshot Name",
    virtual_machine_uuid="9aac5551-a351-4158-8c5c-15a71e8ec5c9")
import * as pulumi from "@pulumi/pulumi";
import * as vsphere from "@pulumi/vsphere";

const demo1 = new vsphere.VirtualMachineSnapshot("demo1", {
    consolidate: true,
    description: "This is Demo Snapshot",
    memory: true,
    quiesce: true,
    removeChildren: false,
    snapshotName: "Snapshot Name",
    virtualMachineUuid: "9aac5551-a351-4158-8c5c-15a71e8ec5c9",
});

Create a VirtualMachineSnapshot Resource

new VirtualMachineSnapshot(name: string, args: VirtualMachineSnapshotArgs, opts?: CustomResourceOptions);
def VirtualMachineSnapshot(resource_name: str, opts: Optional[ResourceOptions] = None, consolidate: Optional[bool] = None, description: Optional[str] = None, memory: Optional[bool] = None, quiesce: Optional[bool] = None, remove_children: Optional[bool] = None, snapshot_name: Optional[str] = None, virtual_machine_uuid: Optional[str] = None)
func NewVirtualMachineSnapshot(ctx *Context, name string, args VirtualMachineSnapshotArgs, opts ...ResourceOption) (*VirtualMachineSnapshot, error)
public VirtualMachineSnapshot(string name, VirtualMachineSnapshotArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args VirtualMachineSnapshotArgs
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 VirtualMachineSnapshotArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args VirtualMachineSnapshotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

VirtualMachineSnapshot Resource Properties

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

Inputs

The VirtualMachineSnapshot resource accepts the following input properties:

Description string

A description for the snapshot.

Memory bool

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

Quiesce bool

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

SnapshotName string

The name of the snapshot.

VirtualMachineUuid string

The virtual machine UUID.

Consolidate bool

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

RemoveChildren bool

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

Description string

A description for the snapshot.

Memory bool

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

Quiesce bool

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

SnapshotName string

The name of the snapshot.

VirtualMachineUuid string

The virtual machine UUID.

Consolidate bool

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

RemoveChildren bool

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

description string

A description for the snapshot.

memory boolean

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

quiesce boolean

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

snapshotName string

The name of the snapshot.

virtualMachineUuid string

The virtual machine UUID.

consolidate boolean

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

removeChildren boolean

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

description str

A description for the snapshot.

memory bool

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

quiesce bool

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

snapshot_name str

The name of the snapshot.

virtual_machine_uuid str

The virtual machine UUID.

consolidate bool

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

remove_children bool

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

Outputs

All input properties are implicitly available as output properties. Additionally, the VirtualMachineSnapshot 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 VirtualMachineSnapshot Resource

Get an existing VirtualMachineSnapshot 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?: VirtualMachineSnapshotState, opts?: CustomResourceOptions): VirtualMachineSnapshot
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, consolidate: Optional[bool] = None, description: Optional[str] = None, memory: Optional[bool] = None, quiesce: Optional[bool] = None, remove_children: Optional[bool] = None, snapshot_name: Optional[str] = None, virtual_machine_uuid: Optional[str] = None) -> VirtualMachineSnapshot
func GetVirtualMachineSnapshot(ctx *Context, name string, id IDInput, state *VirtualMachineSnapshotState, opts ...ResourceOption) (*VirtualMachineSnapshot, error)
public static VirtualMachineSnapshot Get(string name, Input<string> id, VirtualMachineSnapshotState? 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:

Consolidate bool

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

Description string

A description for the snapshot.

Memory bool

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

Quiesce bool

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

RemoveChildren bool

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

SnapshotName string

The name of the snapshot.

VirtualMachineUuid string

The virtual machine UUID.

Consolidate bool

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

Description string

A description for the snapshot.

Memory bool

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

Quiesce bool

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

RemoveChildren bool

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

SnapshotName string

The name of the snapshot.

VirtualMachineUuid string

The virtual machine UUID.

consolidate boolean

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

description string

A description for the snapshot.

memory boolean

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

quiesce boolean

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

removeChildren boolean

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

snapshotName string

The name of the snapshot.

virtualMachineUuid string

The virtual machine UUID.

consolidate bool

If set to true, the delta disks involved in this snapshot will be consolidated into the parent when this resource is destroyed.

description str

A description for the snapshot.

memory bool

If set to true, a dump of the internal state of the virtual machine is included in the snapshot.

quiesce bool

If set to true, and the virtual machine is powered on when the snapshot is taken, VMware Tools is used to quiesce the file system in the virtual machine.

remove_children bool

If set to true, the entire snapshot subtree is removed when this resource is destroyed.

snapshot_name str

The name of the snapshot.

virtual_machine_uuid str

The virtual machine UUID.

Package Details

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