Snapshot

Manages a Disk Snapshot.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new Azure.Core.ResourceGroupArgs
        {
            Location = "West Europe",
        });
        var exampleManagedDisk = new Azure.Compute.ManagedDisk("exampleManagedDisk", new Azure.Compute.ManagedDiskArgs
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            StorageAccountType = "Standard_LRS",
            CreateOption = "Empty",
            DiskSizeGb = 10,
        });
        var exampleSnapshot = new Azure.Compute.Snapshot("exampleSnapshot", new Azure.Compute.SnapshotArgs
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            CreateOption = "Copy",
            SourceUri = exampleManagedDisk.Id,
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/compute"
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/core"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
            Location: pulumi.String("West Europe"),
        })
        if err != nil {
            return err
        }
        exampleManagedDisk, err := compute.NewManagedDisk(ctx, "exampleManagedDisk", &compute.ManagedDiskArgs{
            Location:           exampleResourceGroup.Location,
            ResourceGroupName:  exampleResourceGroup.Name,
            StorageAccountType: pulumi.String("Standard_LRS"),
            CreateOption:       pulumi.String("Empty"),
            DiskSizeGb:         pulumi.Int(10),
        })
        if err != nil {
            return err
        }
        _, err = compute.NewSnapshot(ctx, "exampleSnapshot", &compute.SnapshotArgs{
            Location:          exampleResourceGroup.Location,
            ResourceGroupName: exampleResourceGroup.Name,
            CreateOption:      pulumi.String("Copy"),
            SourceUri:         exampleManagedDisk.ID(),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_managed_disk = azure.compute.ManagedDisk("exampleManagedDisk",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    storage_account_type="Standard_LRS",
    create_option="Empty",
    disk_size_gb="10")
example_snapshot = azure.compute.Snapshot("exampleSnapshot",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    create_option="Copy",
    source_uri=example_managed_disk.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleManagedDisk = new azure.compute.ManagedDisk("exampleManagedDisk", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    storageAccountType: "Standard_LRS",
    createOption: "Empty",
    diskSizeGb: "10",
});
const exampleSnapshot = new azure.compute.Snapshot("exampleSnapshot", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    createOption: "Copy",
    sourceUri: exampleManagedDisk.id,
});

Create a Snapshot Resource

def Snapshot(resource_name, opts=None, create_option=None, disk_size_gb=None, encryption_settings=None, location=None, name=None, resource_group_name=None, source_resource_id=None, source_uri=None, storage_account_id=None, tags=None, __props__=None);
func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)
public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args SnapshotArgs
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 SnapshotArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SnapshotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Snapshot Resource Properties

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

Inputs

The Snapshot resource accepts the following input properties:

CreateOption string

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

DiskSizeGb int

The size of the Snapshotted Disk in GB.

EncryptionSettings SnapshotEncryptionSettingsArgs
Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

SourceResourceId string

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

SourceUri string

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

StorageAccountId string

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

CreateOption string

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

DiskSizeGb int

The size of the Snapshotted Disk in GB.

EncryptionSettings SnapshotEncryptionSettings
Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

SourceResourceId string

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

SourceUri string

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

StorageAccountId string

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

Tags map[string]string

A mapping of tags to assign to the resource.

createOption string

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

diskSizeGb number

The size of the Snapshotted Disk in GB.

encryptionSettings SnapshotEncryptionSettings
location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name string

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

sourceResourceId string

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

sourceUri string

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

storageAccountId string

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

create_option str

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

disk_size_gb float

The size of the Snapshotted Disk in GB.

encryption_settings Dict[SnapshotEncryptionSettings]
location str

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name str

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

source_resource_id str

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

source_uri str

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

storage_account_id str

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

tags Dict[str, str]

A mapping of tags to assign to the resource.

Outputs

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

Get an existing Snapshot 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?: SnapshotState, opts?: CustomResourceOptions): Snapshot
static get(resource_name, id, opts=None, create_option=None, disk_size_gb=None, encryption_settings=None, location=None, name=None, resource_group_name=None, source_resource_id=None, source_uri=None, storage_account_id=None, tags=None, __props__=None);
func GetSnapshot(ctx *Context, name string, id IDInput, state *SnapshotState, opts ...ResourceOption) (*Snapshot, error)
public static Snapshot Get(string name, Input<string> id, SnapshotState? 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:

CreateOption string

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

DiskSizeGb int

The size of the Snapshotted Disk in GB.

EncryptionSettings SnapshotEncryptionSettingsArgs
Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

SourceResourceId string

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

SourceUri string

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

StorageAccountId string

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

Tags Dictionary<string, string>

A mapping of tags to assign to the resource.

CreateOption string

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

DiskSizeGb int

The size of the Snapshotted Disk in GB.

EncryptionSettings SnapshotEncryptionSettings
Location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

Name string

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

SourceResourceId string

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

SourceUri string

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

StorageAccountId string

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

Tags map[string]string

A mapping of tags to assign to the resource.

createOption string

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

diskSizeGb number

The size of the Snapshotted Disk in GB.

encryptionSettings SnapshotEncryptionSettings
location string

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name string

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

sourceResourceId string

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

sourceUri string

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

storageAccountId string

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

tags {[key: string]: string}

A mapping of tags to assign to the resource.

create_option str

Indicates how the snapshot is to be created. Possible values are Copy or Import. Changing this forces a new resource to be created.

disk_size_gb float

The size of the Snapshotted Disk in GB.

encryption_settings Dict[SnapshotEncryptionSettings]
location str

Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

name str

Specifies the name of the Snapshot resource. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.

source_resource_id str

Specifies a reference to an existing snapshot, when create_option is Copy. Changing this forces a new resource to be created.

source_uri str

Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.

storage_account_id str

Specifies the ID of an storage account. Used with source_uri to allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.

tags Dict[str, str]

A mapping of tags to assign to the resource.

Supporting Types

SnapshotEncryptionSettings

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

Enabled bool
DiskEncryptionKey SnapshotEncryptionSettingsDiskEncryptionKeyArgs
KeyEncryptionKey SnapshotEncryptionSettingsKeyEncryptionKeyArgs
Enabled bool
DiskEncryptionKey SnapshotEncryptionSettingsDiskEncryptionKey
KeyEncryptionKey SnapshotEncryptionSettingsKeyEncryptionKey
enabled boolean
diskEncryptionKey SnapshotEncryptionSettingsDiskEncryptionKey
keyEncryptionKey SnapshotEncryptionSettingsKeyEncryptionKey
enabled bool
diskEncryptionKey Dict[SnapshotEncryptionSettingsDiskEncryptionKey]
keyEncryptionKey Dict[SnapshotEncryptionSettingsKeyEncryptionKey]

SnapshotEncryptionSettingsDiskEncryptionKey

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

SecretUrl string
SourceVaultId string
SecretUrl string
SourceVaultId string
secretUrl string
sourceVaultId string
secretUrl str
sourceVaultId str

SnapshotEncryptionSettingsKeyEncryptionKey

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

KeyUrl string
SourceVaultId string
KeyUrl string
SourceVaultId string
keyUrl string
sourceVaultId string
keyUrl str
sourceVaultId str

Package Details

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