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
new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);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:
- Create
Option string Indicates how the snapshot is to be created. Possible values are
CopyorImport. Changing this forces a new resource to be created.- Resource
Group stringName The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- Disk
Size intGb The size of the Snapshotted Disk in GB.
- Encryption
Settings SnapshotEncryption Settings Args - 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.
- Source
Resource stringId Specifies a reference to an existing snapshot, when
create_optionisCopy. Changing this forces a new resource to be created.- Source
Uri string Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
- Storage
Account stringId Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- Dictionary<string, string>
A mapping of tags to assign to the resource.
- Create
Option string Indicates how the snapshot is to be created. Possible values are
CopyorImport. Changing this forces a new resource to be created.- Resource
Group stringName The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- Disk
Size intGb The size of the Snapshotted Disk in GB.
- Encryption
Settings SnapshotEncryption Settings - 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.
- Source
Resource stringId Specifies a reference to an existing snapshot, when
create_optionisCopy. Changing this forces a new resource to be created.- Source
Uri string Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
- Storage
Account stringId Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- map[string]string
A mapping of tags to assign to the resource.
- create
Option string Indicates how the snapshot is to be created. Possible values are
CopyorImport. Changing this forces a new resource to be created.- resource
Group stringName The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- disk
Size numberGb The size of the Snapshotted Disk in GB.
- encryption
Settings SnapshotEncryption Settings - 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.
- source
Resource stringId Specifies a reference to an existing snapshot, when
create_optionisCopy. Changing this forces a new resource to be created.- source
Uri string Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
- storage
Account stringId Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- {[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
CopyorImport. Changing this forces a new resource to be created.- resource_
group_ strname The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- disk_
size_ floatgb The size of the Snapshotted Disk in GB.
- encryption_
settings Dict[SnapshotEncryption Settings] - 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_ strid Specifies a reference to an existing snapshot, when
create_optionisCopy. 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_ strid Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- 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:
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): Snapshotstatic 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:
- Create
Option string Indicates how the snapshot is to be created. Possible values are
CopyorImport. Changing this forces a new resource to be created.- Disk
Size intGb The size of the Snapshotted Disk in GB.
- Encryption
Settings SnapshotEncryption Settings Args - 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.
- Resource
Group stringName The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- Source
Resource stringId Specifies a reference to an existing snapshot, when
create_optionisCopy. Changing this forces a new resource to be created.- Source
Uri string Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
- Storage
Account stringId Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- Dictionary<string, string>
A mapping of tags to assign to the resource.
- Create
Option string Indicates how the snapshot is to be created. Possible values are
CopyorImport. Changing this forces a new resource to be created.- Disk
Size intGb The size of the Snapshotted Disk in GB.
- Encryption
Settings SnapshotEncryption Settings - 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.
- Resource
Group stringName The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- Source
Resource stringId Specifies a reference to an existing snapshot, when
create_optionisCopy. Changing this forces a new resource to be created.- Source
Uri string Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
- Storage
Account stringId Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- map[string]string
A mapping of tags to assign to the resource.
- create
Option string Indicates how the snapshot is to be created. Possible values are
CopyorImport. Changing this forces a new resource to be created.- disk
Size numberGb The size of the Snapshotted Disk in GB.
- encryption
Settings SnapshotEncryption Settings - 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.
- resource
Group stringName The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- source
Resource stringId Specifies a reference to an existing snapshot, when
create_optionisCopy. Changing this forces a new resource to be created.- source
Uri string Specifies the URI to a Managed or Unmanaged Disk. Changing this forces a new resource to be created.
- storage
Account stringId Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- {[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
CopyorImport. Changing this forces a new resource to be created.- disk_
size_ floatgb The size of the Snapshotted Disk in GB.
- encryption_
settings Dict[SnapshotEncryption Settings] - 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_ strname The name of the resource group in which to create the Snapshot. Changing this forces a new resource to be created.
- source_
resource_ strid Specifies a reference to an existing snapshot, when
create_optionisCopy. 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_ strid Specifies the ID of an storage account. Used with
source_urito allow authorization during import of unmanaged blobs from a different subscription. Changing this forces a new resource to be created.- Dict[str, str]
A mapping of tags to assign to the resource.
Supporting Types
SnapshotEncryptionSettings
SnapshotEncryptionSettingsDiskEncryptionKey
SnapshotEncryptionSettingsKeyEncryptionKey
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.