VolumeSnapshot class
NetApp Volumes helps you manage your data usage with snapshots that can quickly restore lost data. Snapshots are point-in-time versions of your volume's content. They are resources of volumes and are instant captures of your data that consume space only for modified data. Because data changes over time, snapshots usually consume more space as they get older. NetApp Volumes volumes use just-in-time copy-on-write so that unmodified files in snapshots don't consume any of the volume's capacity.
To get more information about VolumeSnapshot, see:
- API documentation
- How-to Guides
- Documentation
Example Usage
Volume Snapshot Create
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const _default = gcp.compute.getNetwork({
name: "test-network",
});
const defaultStoragePool = new gcp.netapp.StoragePool("default", {
name: "test-pool",
location: "us-west2",
serviceLevel: "PREMIUM",
capacityGib: "2048",
network: _default.then(_default => _default.id),
});
const defaultVolume = new gcp.netapp.Volume("default", {
location: defaultStoragePool.location,
name: "test-volume",
capacityGib: "100",
shareName: "test-volume",
storagePool: defaultStoragePool.name,
protocols: ["NFSV3"],
});
const testSnapshot = new gcp.netapp.VolumeSnapshot("test_snapshot", {
location: defaultVolume.location,
volumeName: defaultVolume.name,
name: "testvolumesnap",
}, {
dependsOn: [defaultVolume],
});
import pulumi
import pulumi_gcp as gcp
default = gcp.compute.get_network(name="test-network")
default_storage_pool = gcp.netapp.StoragePool("default",
name="test-pool",
location="us-west2",
service_level="PREMIUM",
capacity_gib="2048",
network=default.id)
default_volume = gcp.netapp.Volume("default",
location=default_storage_pool.location,
name="test-volume",
capacity_gib="100",
share_name="test-volume",
storage_pool=default_storage_pool.name,
protocols=["NFSV3"])
test_snapshot = gcp.netapp.VolumeSnapshot("test_snapshot",
location=default_volume.location,
volume_name=default_volume.name,
name="testvolumesnap",
opts = pulumi.ResourceOptions(depends_on=[default_volume]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var @default = Gcp.Compute.GetNetwork.Invoke(new()
{
Name = "test-network",
});
var defaultStoragePool = new Gcp.Netapp.StoragePool("default", new()
{
Name = "test-pool",
Location = "us-west2",
ServiceLevel = "PREMIUM",
CapacityGib = "2048",
Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
});
var defaultVolume = new Gcp.Netapp.Volume("default", new()
{
Location = defaultStoragePool.Location,
Name = "test-volume",
CapacityGib = "100",
ShareName = "test-volume",
StoragePool = defaultStoragePool.Name,
Protocols = new[]
{
"NFSV3",
},
});
var testSnapshot = new Gcp.Netapp.VolumeSnapshot("test_snapshot", new()
{
Location = defaultVolume.Location,
VolumeName = defaultVolume.Name,
Name = "testvolumesnap",
}, new CustomResourceOptions
{
DependsOn =
{
defaultVolume,
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/netapp"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_default, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
Name: pulumi.StringRef("test-network"),
}, nil)
if err != nil {
return err
}
defaultStoragePool, err := netapp.NewStoragePool(ctx, "default", &netapp.StoragePoolArgs{
Name: pulumi.String("test-pool"),
Location: pulumi.String("us-west2"),
ServiceLevel: pulumi.String("PREMIUM"),
CapacityGib: pulumi.String("2048"),
Network: pulumi.String(_default.Id),
})
if err != nil {
return err
}
defaultVolume, err := netapp.NewVolume(ctx, "default", &netapp.VolumeArgs{
Location: defaultStoragePool.Location,
Name: pulumi.String("test-volume"),
CapacityGib: pulumi.String("100"),
ShareName: pulumi.String("test-volume"),
StoragePool: defaultStoragePool.Name,
Protocols: pulumi.StringArray{
pulumi.String("NFSV3"),
},
})
if err != nil {
return err
}
_, err = netapp.NewVolumeSnapshot(ctx, "test_snapshot", &netapp.VolumeSnapshotArgs{
Location: defaultVolume.Location,
VolumeName: defaultVolume.Name,
Name: pulumi.String("testvolumesnap"),
}, pulumi.DependsOn([]pulumi.Resource{
defaultVolume,
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
data "gcp_compute_getnetwork" "default" {
name = "test-network"
}
resource "gcp_netapp_storagepool" "default" {
name = "test-pool"
location = "us-west2"
service_level = "PREMIUM"
capacity_gib = 2048
network = data.gcp_compute_getnetwork.default.id
}
resource "gcp_netapp_volume" "default" {
location = gcp_netapp_storagepool.default.location
name = "test-volume"
capacity_gib = 100
share_name = "test-volume"
storage_pool = gcp_netapp_storagepool.default.name
protocols = ["NFSV3"]
}
resource "gcp_netapp_volumesnapshot" "test_snapshot" {
depends_on = [gcp_netapp_volume.default]
location = gcp_netapp_volume.default.location
volume_name = gcp_netapp_volume.default.name
name = "testvolumesnap"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
import com.pulumi.gcp.netapp.StoragePool;
import com.pulumi.gcp.netapp.StoragePoolArgs;
import com.pulumi.gcp.netapp.Volume;
import com.pulumi.gcp.netapp.VolumeArgs;
import com.pulumi.gcp.netapp.VolumeSnapshot;
import com.pulumi.gcp.netapp.VolumeSnapshotArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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) {
final var default = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("test-network")
.build());
var defaultStoragePool = new StoragePool("defaultStoragePool", StoragePoolArgs.builder()
.name("test-pool")
.location("us-west2")
.serviceLevel("PREMIUM")
.capacityGib("2048")
.network(default_.id())
.build());
var defaultVolume = new Volume("defaultVolume", VolumeArgs.builder()
.location(defaultStoragePool.location())
.name("test-volume")
.capacityGib("100")
.shareName("test-volume")
.storagePool(defaultStoragePool.name())
.protocols("NFSV3")
.build());
var testSnapshot = new VolumeSnapshot("testSnapshot", VolumeSnapshotArgs.builder()
.location(defaultVolume.location())
.volumeName(defaultVolume.name())
.name("testvolumesnap")
.build(), CustomResourceOptions.builder()
.dependsOn(defaultVolume)
.build());
}
}
resources:
defaultStoragePool:
type: gcp:netapp:StoragePool
name: default
properties:
name: test-pool
location: us-west2
serviceLevel: PREMIUM
capacityGib: 2048
network: ${default.id}
defaultVolume:
type: gcp:netapp:Volume
name: default
properties:
location: ${defaultStoragePool.location}
name: test-volume
capacityGib: 100
shareName: test-volume
storagePool: ${defaultStoragePool.name}
protocols:
- NFSV3
testSnapshot:
type: gcp:netapp:VolumeSnapshot
name: test_snapshot
properties:
location: ${defaultVolume.location}
volumeName: ${defaultVolume.name}
name: testvolumesnap
options:
dependsOn:
- ${defaultVolume}
variables:
default:
fn::invoke:
function: gcp:compute:getNetwork
arguments:
name: test-network
Import
VolumeSnapshot can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/snapshots/{{name}}{{project}}/{{location}}/{{volume_name}}/{{name}}{{location}}/{{volume_name}}/{{name}}
When using the pulumi import command, VolumeSnapshot can be imported using one of the formats above. For example:
$ pulumi import gcp:netapp/volumeSnapshot:VolumeSnapshot default projects/{{project}}/locations/{{location}}/volumes/{{volume_name}}/snapshots/{{name}}
$ pulumi import gcp:netapp/volumeSnapshot:VolumeSnapshot default {{project}}/{{location}}/{{volume_name}}/{{name}}
$ pulumi import gcp:netapp/volumeSnapshot:VolumeSnapshot default {{location}}/{{volume_name}}/{{name}}
Constructors
- VolumeSnapshot(String name, {VolumeSnapshotArgs? args, CustomResourceOptions? options})
-
Creates a new VolumeSnapshot.
nameThe Pulumi resource name.argsArguments used to configure this VolumeSnapshot. The set of arguments for VolumeSnapshot.optionsResource options controlling this resource's behavior. - VolumeSnapshot.reference(String urn)
- Creates a typed reference to an existing VolumeSnapshot resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
deletionPolicy
↔ Output<
String> -
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
When a 'terraform destroy' or 'pulumi up' would delete the resource,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
description
↔ Output<
String?> -
Description for the snapshot.
latefinal
-
effectiveLabels
↔ Output<
Map< String, String> > -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
labels
↔ Output<
Map< String, String> ?> -
Labels as key value pairs. Example:
{ "owner": "Bob", "department": "finance", "purpose": "testing" }.latefinal -
location
↔ Output<
String> -
Name of the snapshot location. Snapshots are child resources of volumes and live in the same location.
latefinal
-
name
↔ Output<
String> -
The name of the snapshot.
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
latefinal
-
pulumiLabels
↔ Output<
Map< String, String> > -
The combination of labels configured directly on the resource
and default labels configured on the provider.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
usedBytes
↔ Output<
int> -
Storage used to store blocks unique to this snapshot.
latefinal
-
volumeName
↔ Output<
String> -
The name of the volume to create the snapshot in.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {VolumeSnapshotState? state, CustomResourceOptions? options}) → VolumeSnapshot -
Gets an existing VolumeSnapshot resource's state with the given
nameandid.