Snapshot

class Snapshot : KotlinCustomResource

Manages a Disk Snapshot.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = new azure.core.ResourceGroup("example", {
name: "snapshot-rg",
location: "West Europe",
});
const exampleManagedDisk = new azure.compute.ManagedDisk("example", {
name: "managed-disk",
location: example.location,
resourceGroupName: example.name,
storageAccountType: "Standard_LRS",
createOption: "Empty",
diskSizeGb: 10,
});
const exampleSnapshot = new azure.compute.Snapshot("example", {
name: "snapshot",
location: example.location,
resourceGroupName: example.name,
createOption: "Copy",
sourceUri: exampleManagedDisk.id,
});
import pulumi
import pulumi_azure as azure
example = azure.core.ResourceGroup("example",
name="snapshot-rg",
location="West Europe")
example_managed_disk = azure.compute.ManagedDisk("example",
name="managed-disk",
location=example.location,
resource_group_name=example.name,
storage_account_type="Standard_LRS",
create_option="Empty",
disk_size_gb=10)
example_snapshot = azure.compute.Snapshot("example",
name="snapshot",
location=example.location,
resource_group_name=example.name,
create_option="Copy",
source_uri=example_managed_disk.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = new Azure.Core.ResourceGroup("example", new()
{
Name = "snapshot-rg",
Location = "West Europe",
});
var exampleManagedDisk = new Azure.Compute.ManagedDisk("example", new()
{
Name = "managed-disk",
Location = example.Location,
ResourceGroupName = example.Name,
StorageAccountType = "Standard_LRS",
CreateOption = "Empty",
DiskSizeGb = 10,
});
var exampleSnapshot = new Azure.Compute.Snapshot("example", new()
{
Name = "snapshot",
Location = example.Location,
ResourceGroupName = example.Name,
CreateOption = "Copy",
SourceUri = exampleManagedDisk.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/compute"
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("snapshot-rg"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
exampleManagedDisk, err := compute.NewManagedDisk(ctx, "example", &compute.ManagedDiskArgs{
Name: pulumi.String("managed-disk"),
Location: example.Location,
ResourceGroupName: example.Name,
StorageAccountType: pulumi.String("Standard_LRS"),
CreateOption: pulumi.String("Empty"),
DiskSizeGb: pulumi.Int(10),
})
if err != nil {
return err
}
_, err = compute.NewSnapshot(ctx, "example", &compute.SnapshotArgs{
Name: pulumi.String("snapshot"),
Location: example.Location,
ResourceGroupName: example.Name,
CreateOption: pulumi.String("Copy"),
SourceUri: exampleManagedDisk.ID(),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.compute.ManagedDisk;
import com.pulumi.azure.compute.ManagedDiskArgs;
import com.pulumi.azure.compute.Snapshot;
import com.pulumi.azure.compute.SnapshotArgs;
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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
.name("snapshot-rg")
.location("West Europe")
.build());
var exampleManagedDisk = new ManagedDisk("exampleManagedDisk", ManagedDiskArgs.builder()
.name("managed-disk")
.location(example.location())
.resourceGroupName(example.name())
.storageAccountType("Standard_LRS")
.createOption("Empty")
.diskSizeGb(10)
.build());
var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
.name("snapshot")
.location(example.location())
.resourceGroupName(example.name())
.createOption("Copy")
.sourceUri(exampleManagedDisk.id())
.build());
}
}
resources:
example:
type: azure:core:ResourceGroup
properties:
name: snapshot-rg
location: West Europe
exampleManagedDisk:
type: azure:compute:ManagedDisk
name: example
properties:
name: managed-disk
location: ${example.location}
resourceGroupName: ${example.name}
storageAccountType: Standard_LRS
createOption: Empty
diskSizeGb: '10'
exampleSnapshot:
type: azure:compute:Snapshot
name: example
properties:
name: snapshot
location: ${example.location}
resourceGroupName: ${example.name}
createOption: Copy
sourceUri: ${exampleManagedDisk.id}

Import

Snapshots can be imported using the resource id, e.g.

$ pulumi import azure:compute/snapshot:Snapshot example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Compute/snapshots/snapshot1

Properties

Link copied to clipboard
val createOption: Output<String>

Indicates how the snapshot is to be created. Possible values are Copy or Import.

Link copied to clipboard
val diskAccessId: Output<String>?

Specifies the ID of the Disk Access which should be used for this Snapshot. This is used in conjunction with setting network_access_policy to AllowPrivate.

Link copied to clipboard
val diskSizeGb: Output<Int>

The size of the Snapshotted Disk in GB.

Link copied to clipboard

A encryption_settings block as defined below.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

Specifies if the Snapshot is incremental. Changing this forces a new resource to be created.

Link copied to clipboard
val location: Output<String>

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

Link copied to clipboard
val name: Output<String>

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

Link copied to clipboard

Policy for accessing the disk via network. Possible values are AllowAll, AllowPrivate, or DenyAll. Defaults to AllowAll.

Link copied to clipboard

Policy for controlling export on the disk. Possible values are true or false. Defaults to true.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
val sourceResourceId: Output<String>?

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

Link copied to clipboard
val sourceUri: Output<String>?

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

Link copied to clipboard
val storageAccountId: Output<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.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A mapping of tags to assign to the resource.

Link copied to clipboard

Whether Trusted Launch is enabled for the Snapshot.

Link copied to clipboard
val urn: Output<String>