InstantSnapshot class

Represents an instant snapshot resource.

An instant snapshot is an in-place backup of a disk that can be used to rapidly create a new disk in minutes.

Instant snapshots capture data at a specific point in time. They are optimized for rapidly restoring captured data to a new disk. Use instant snapshots to quickly recover data in cases where the zone and disk are still intact but the data on the disk has been lost or corrupted

To get more information about InstantSnapshot, see:

Example Usage

Instant Snapshot Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const foo = new gcp.compute.Disk("foo", {
    name: "example-disk",
    type: "pd-ssd",
    size: 10,
});
const _default = new gcp.compute.InstantSnapshot("default", {
    name: "instant-snapshot",
    zone: "us-central1-a",
    sourceDisk: foo.selfLink,
});
import pulumi
import pulumi_gcp as gcp

foo = gcp.compute.Disk("foo",
    name="example-disk",
    type="pd-ssd",
    size=10)
default = gcp.compute.InstantSnapshot("default",
    name="instant-snapshot",
    zone="us-central1-a",
    source_disk=foo.self_link)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var foo = new Gcp.Compute.Disk("foo", new()
    {
        Name = "example-disk",
        Type = "pd-ssd",
        Size = 10,
    });

    var @default = new Gcp.Compute.InstantSnapshot("default", new()
    {
        Name = "instant-snapshot",
        Zone = "us-central1-a",
        SourceDisk = foo.SelfLink,
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		foo, err := compute.NewDisk(ctx, "foo", &compute.DiskArgs{
			Name: pulumi.String("example-disk"),
			Type: pulumi.String("pd-ssd"),
			Size: pulumi.Int(10),
		})
		if err != nil {
			return err
		}
		_, err = compute.NewInstantSnapshot(ctx, "default", &compute.InstantSnapshotArgs{
			Name:       pulumi.String("instant-snapshot"),
			Zone:       pulumi.String("us-central1-a"),
			SourceDisk: foo.SelfLink,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_compute_disk" "foo" {
  name = "example-disk"
  type = "pd-ssd"
  size = 10
}
resource "gcp_compute_instantsnapshot" "default" {
  name        = "instant-snapshot"
  zone        = "us-central1-a"
  source_disk = gcp_compute_disk.foo.self_link
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Disk;
import com.pulumi.gcp.compute.DiskArgs;
import com.pulumi.gcp.compute.InstantSnapshot;
import com.pulumi.gcp.compute.InstantSnapshotArgs;
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) {
        var foo = new Disk("foo", DiskArgs.builder()
            .name("example-disk")
            .type("pd-ssd")
            .size(10)
            .build());

        var default_ = new InstantSnapshot("default", InstantSnapshotArgs.builder()
            .name("instant-snapshot")
            .zone("us-central1-a")
            .sourceDisk(foo.selfLink())
            .build());

    }
}
resources:
  foo:
    type: gcp:compute:Disk
    properties:
      name: example-disk
      type: pd-ssd
      size: 10
  default:
    type: gcp:compute:InstantSnapshot
    properties:
      name: instant-snapshot
      zone: us-central1-a
      sourceDisk: ${foo.selfLink}

Import

InstantSnapshot can be imported using any of these accepted formats:

  • projects/{{project}}/zones/{{zone}}/instantSnapshots/{{name}}
  • {{project}}/{{zone}}/{{name}}
  • {{zone}}/{{name}}
  • {{name}}

When using the pulumi import command, InstantSnapshot can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default projects/{{project}}/zones/{{zone}}/instantSnapshots/{{name}}
$ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default {{project}}/{{zone}}/{{name}}
$ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default {{zone}}/{{name}}
$ pulumi import gcp:compute/instantSnapshot:InstantSnapshot default {{name}}

Constructors

InstantSnapshot(String name, {InstantSnapshotArgs? args, CustomResourceOptions? options})
Creates a new InstantSnapshot. name The Pulumi resource name. args Arguments used to configure this InstantSnapshot. The set of arguments for InstantSnapshot. options Resource options controlling this resource's behavior.
InstantSnapshot.reference(String urn)
Creates a typed reference to an existing InstantSnapshot resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
creationTimestamp ↔ Output<String>
Creation timestamp in RFC3339 text format.
latefinal
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?>
An optional description of this resource.
latefinal
diskSizeGb ↔ Output<int>
Size of the snapshot, specified in GB.
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
labelFingerprint ↔ Output<String>
The fingerprint used for optimistic locking of this resource. Used internally during updates.
latefinal
labels ↔ Output<Map<String, String>?>
Labels to apply to this InstantSnapshot. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effectiveLabels for all of the labels present on the resource.
latefinal
name ↔ Output<String>
Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression a-z? which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
latefinal
params ↔ Output<InstantSnapshotParams?>
Additional params passed with the request, but not persisted as part of resource payload Structure is documented below.
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
The URI of the created resource.
latefinal
sourceDisk ↔ Output<String>
A reference to the disk used to create this instant snapshot.
latefinal
sourceDiskId ↔ Output<String>
The ID value of the disk used to create this InstantSnapshot.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
zone ↔ Output<String>
A reference to the zone where the disk is located.
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, {InstantSnapshotState? state, CustomResourceOptions? options}) → InstantSnapshot
Gets an existing InstantSnapshot resource's state with the given name and id.