1. Packages
  2. Vsphere Provider
  3. API Docs
  4. VirtualMachineSnapshot
vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi

vsphere.VirtualMachineSnapshot

Explore with Pulumi AI

vsphere logo
vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi

    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

    import * as pulumi from "@pulumi/pulumi";
    import * as vsphere from "@pulumi/vsphere";
    
    const demo1 = new vsphere.VirtualMachineSnapshot("demo1", {
        virtualMachineUuid: "9aac5551-a351-4158-8c5c-15a71e8ec5c9",
        snapshotName: "Snapshot Name",
        description: "This is Demo Snapshot",
        memory: true,
        quiesce: true,
        removeChildren: false,
        consolidate: true,
    });
    
    import pulumi
    import pulumi_vsphere as vsphere
    
    demo1 = vsphere.VirtualMachineSnapshot("demo1",
        virtual_machine_uuid="9aac5551-a351-4158-8c5c-15a71e8ec5c9",
        snapshot_name="Snapshot Name",
        description="This is Demo Snapshot",
        memory=True,
        quiesce=True,
        remove_children=False,
        consolidate=True)
    
    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 {
    		_, err := vsphere.NewVirtualMachineSnapshot(ctx, "demo1", &vsphere.VirtualMachineSnapshotArgs{
    			VirtualMachineUuid: pulumi.String("9aac5551-a351-4158-8c5c-15a71e8ec5c9"),
    			SnapshotName:       pulumi.String("Snapshot Name"),
    			Description:        pulumi.String("This is Demo Snapshot"),
    			Memory:             pulumi.Bool(true),
    			Quiesce:            pulumi.Bool(true),
    			RemoveChildren:     pulumi.Bool(false),
    			Consolidate:        pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using VSphere = Pulumi.VSphere;
    
    return await Deployment.RunAsync(() => 
    {
        var demo1 = new VSphere.VirtualMachineSnapshot("demo1", new()
        {
            VirtualMachineUuid = "9aac5551-a351-4158-8c5c-15a71e8ec5c9",
            SnapshotName = "Snapshot Name",
            Description = "This is Demo Snapshot",
            Memory = true,
            Quiesce = true,
            RemoveChildren = false,
            Consolidate = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vsphere.VirtualMachineSnapshot;
    import com.pulumi.vsphere.VirtualMachineSnapshotArgs;
    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) {
            var demo1 = new VirtualMachineSnapshot("demo1", VirtualMachineSnapshotArgs.builder()
                .virtualMachineUuid("9aac5551-a351-4158-8c5c-15a71e8ec5c9")
                .snapshotName("Snapshot Name")
                .description("This is Demo Snapshot")
                .memory("true")
                .quiesce("true")
                .removeChildren("false")
                .consolidate("true")
                .build());
    
        }
    }
    
    resources:
      demo1:
        type: vsphere:VirtualMachineSnapshot
        properties:
          virtualMachineUuid: 9aac5551-a351-4158-8c5c-15a71e8ec5c9
          snapshotName: Snapshot Name
          description: This is Demo Snapshot
          memory: 'true'
          quiesce: 'true'
          removeChildren: 'false'
          consolidate: 'true'
    

    Create VirtualMachineSnapshot Resource

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

    Constructor syntax

    new VirtualMachineSnapshot(name: string, args: VirtualMachineSnapshotArgs, opts?: CustomResourceOptions);
    @overload
    def VirtualMachineSnapshot(resource_name: str,
                               args: VirtualMachineSnapshotArgs,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def VirtualMachineSnapshot(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               description: Optional[str] = None,
                               memory: Optional[bool] = None,
                               quiesce: Optional[bool] = None,
                               snapshot_name: Optional[str] = None,
                               virtual_machine_uuid: Optional[str] = None,
                               consolidate: Optional[bool] = None,
                               remove_children: Optional[bool] = None)
    func NewVirtualMachineSnapshot(ctx *Context, name string, args VirtualMachineSnapshotArgs, opts ...ResourceOption) (*VirtualMachineSnapshot, error)
    public VirtualMachineSnapshot(string name, VirtualMachineSnapshotArgs args, CustomResourceOptions? opts = null)
    public VirtualMachineSnapshot(String name, VirtualMachineSnapshotArgs args)
    public VirtualMachineSnapshot(String name, VirtualMachineSnapshotArgs args, CustomResourceOptions options)
    
    type: vsphere:VirtualMachineSnapshot
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    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.
    args VirtualMachineSnapshotArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control 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.
    name String
    The unique name of the resource.
    args VirtualMachineSnapshotArgs
    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 virtualMachineSnapshotResource = new VSphere.VirtualMachineSnapshot("virtualMachineSnapshotResource", new()
    {
        Description = "string",
        Memory = false,
        Quiesce = false,
        SnapshotName = "string",
        VirtualMachineUuid = "string",
        Consolidate = false,
        RemoveChildren = false,
    });
    
    example, err := vsphere.NewVirtualMachineSnapshot(ctx, "virtualMachineSnapshotResource", &vsphere.VirtualMachineSnapshotArgs{
    	Description:        pulumi.String("string"),
    	Memory:             pulumi.Bool(false),
    	Quiesce:            pulumi.Bool(false),
    	SnapshotName:       pulumi.String("string"),
    	VirtualMachineUuid: pulumi.String("string"),
    	Consolidate:        pulumi.Bool(false),
    	RemoveChildren:     pulumi.Bool(false),
    })
    
    var virtualMachineSnapshotResource = new VirtualMachineSnapshot("virtualMachineSnapshotResource", VirtualMachineSnapshotArgs.builder()
        .description("string")
        .memory(false)
        .quiesce(false)
        .snapshotName("string")
        .virtualMachineUuid("string")
        .consolidate(false)
        .removeChildren(false)
        .build());
    
    virtual_machine_snapshot_resource = vsphere.VirtualMachineSnapshot("virtualMachineSnapshotResource",
        description="string",
        memory=False,
        quiesce=False,
        snapshot_name="string",
        virtual_machine_uuid="string",
        consolidate=False,
        remove_children=False)
    
    const virtualMachineSnapshotResource = new vsphere.VirtualMachineSnapshot("virtualMachineSnapshotResource", {
        description: "string",
        memory: false,
        quiesce: false,
        snapshotName: "string",
        virtualMachineUuid: "string",
        consolidate: false,
        removeChildren: false,
    });
    
    type: vsphere:VirtualMachineSnapshot
    properties:
        consolidate: false
        description: string
        memory: false
        quiesce: false
        removeChildren: false
        snapshotName: string
        virtualMachineUuid: string
    

    VirtualMachineSnapshot 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 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 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.
    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.

    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 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 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)
    public static VirtualMachineSnapshot get(String name, Output<String> id, VirtualMachineSnapshotState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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.
    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 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.
    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.

    Package Details

    Repository
    vSphere pulumi/pulumi-vsphere
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vsphere Terraform Provider.
    vsphere logo
    vSphere v4.12.1 published on Tuesday, Oct 22, 2024 by Pulumi