1. Packages
  2. Gcorelabs Provider
  3. API Docs
  4. Snapshot
gcorelabs 0.3.63 published on Monday, Apr 14, 2025 by g-core

gcorelabs.Snapshot

Explore with Pulumi AI

Example Usage

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

const snapshot = new gcore.index.Gcore_snapshot("snapshot", {
    projectId: 1,
    regionId: 1,
    name: "snapshot example",
    volumeId: "28e9edcb-1593-41fe-971b-da729c6ec301",
    description: "snapshot example description",
    metadata: {
        env: "test",
    },
});
Copy
import pulumi
import pulumi_gcore as gcore

snapshot = gcore.index.Gcore_snapshot("snapshot",
    project_id=1,
    region_id=1,
    name=snapshot example,
    volume_id=28e9edcb-1593-41fe-971b-da729c6ec301,
    description=snapshot example description,
    metadata={
        env: test,
    })
Copy
package main

import (
	"github.com/pulumi/pulumi-gcore/sdk/go/gcore"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := gcore.NewGcore_snapshot(ctx, "snapshot", &gcore.Gcore_snapshotArgs{
			ProjectId:   1,
			RegionId:    1,
			Name:        "snapshot example",
			VolumeId:    "28e9edcb-1593-41fe-971b-da729c6ec301",
			Description: "snapshot example description",
			Metadata: map[string]interface{}{
				"env": "test",
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcore = Pulumi.Gcore;

return await Deployment.RunAsync(() => 
{
    var snapshot = new Gcore.Index.Gcore_snapshot("snapshot", new()
    {
        ProjectId = 1,
        RegionId = 1,
        Name = "snapshot example",
        VolumeId = "28e9edcb-1593-41fe-971b-da729c6ec301",
        Description = "snapshot example description",
        Metadata = 
        {
            { "env", "test" },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcore.gcore_snapshot;
import com.pulumi.gcore.Gcore_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 snapshot = new Gcore_snapshot("snapshot", Gcore_snapshotArgs.builder()
            .projectId(1)
            .regionId(1)
            .name("snapshot example")
            .volumeId("28e9edcb-1593-41fe-971b-da729c6ec301")
            .description("snapshot example description")
            .metadata(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
            .build());

    }
}
Copy
resources:
  snapshot:
    type: gcore:gcore_snapshot
    properties:
      projectId: 1
      regionId: 1
      name: snapshot example
      volumeId: 28e9edcb-1593-41fe-971b-da729c6ec301
      description: snapshot example description
      metadata:
        env: test
Copy

Create Snapshot Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Snapshot(name: string, args: SnapshotArgs, opts?: CustomResourceOptions);
@overload
def Snapshot(resource_name: str,
             args: SnapshotArgs,
             opts: Optional[ResourceOptions] = None)

@overload
def Snapshot(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             volume_id: Optional[str] = None,
             description: Optional[str] = None,
             last_updated: Optional[str] = None,
             metadata: Optional[Mapping[str, str]] = None,
             name: Optional[str] = None,
             project_id: Optional[float] = None,
             project_name: Optional[str] = None,
             region_id: Optional[float] = None,
             region_name: Optional[str] = None,
             snapshot_id: Optional[str] = None)
func NewSnapshot(ctx *Context, name string, args SnapshotArgs, opts ...ResourceOption) (*Snapshot, error)
public Snapshot(string name, SnapshotArgs args, CustomResourceOptions? opts = null)
public Snapshot(String name, SnapshotArgs args)
public Snapshot(String name, SnapshotArgs args, CustomResourceOptions options)
type: gcorelabs:Snapshot
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SnapshotArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var snapshotResource = new Gcorelabs.Snapshot("snapshotResource", new()
{
    VolumeId = "string",
    Description = "string",
    LastUpdated = "string",
    Metadata = 
    {
        { "string", "string" },
    },
    Name = "string",
    ProjectId = 0,
    ProjectName = "string",
    RegionId = 0,
    RegionName = "string",
    SnapshotId = "string",
});
Copy
example, err := gcorelabs.NewSnapshot(ctx, "snapshotResource", &gcorelabs.SnapshotArgs{
VolumeId: pulumi.String("string"),
Description: pulumi.String("string"),
LastUpdated: pulumi.String("string"),
Metadata: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
ProjectId: pulumi.Float64(0),
ProjectName: pulumi.String("string"),
RegionId: pulumi.Float64(0),
RegionName: pulumi.String("string"),
SnapshotId: pulumi.String("string"),
})
Copy
var snapshotResource = new Snapshot("snapshotResource", SnapshotArgs.builder()
    .volumeId("string")
    .description("string")
    .lastUpdated("string")
    .metadata(Map.of("string", "string"))
    .name("string")
    .projectId(0)
    .projectName("string")
    .regionId(0)
    .regionName("string")
    .snapshotId("string")
    .build());
Copy
snapshot_resource = gcorelabs.Snapshot("snapshotResource",
    volume_id="string",
    description="string",
    last_updated="string",
    metadata={
        "string": "string",
    },
    name="string",
    project_id=0,
    project_name="string",
    region_id=0,
    region_name="string",
    snapshot_id="string")
Copy
const snapshotResource = new gcorelabs.Snapshot("snapshotResource", {
    volumeId: "string",
    description: "string",
    lastUpdated: "string",
    metadata: {
        string: "string",
    },
    name: "string",
    projectId: 0,
    projectName: "string",
    regionId: 0,
    regionName: "string",
    snapshotId: "string",
});
Copy
type: gcorelabs:Snapshot
properties:
    description: string
    lastUpdated: string
    metadata:
        string: string
    name: string
    projectId: 0
    projectName: string
    regionId: 0
    regionName: string
    snapshotId: string
    volumeId: string
Copy

Snapshot Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Snapshot resource accepts the following input properties:

VolumeId This property is required. string
Description string
LastUpdated string
Metadata Dictionary<string, string>
Name string
ProjectId double
ProjectName string
RegionId double
RegionName string
SnapshotId string
The ID of this resource.
VolumeId This property is required. string
Description string
LastUpdated string
Metadata map[string]string
Name string
ProjectId float64
ProjectName string
RegionId float64
RegionName string
SnapshotId string
The ID of this resource.
volumeId This property is required. String
description String
lastUpdated String
metadata Map<String,String>
name String
projectId Double
projectName String
regionId Double
regionName String
snapshotId String
The ID of this resource.
volumeId This property is required. string
description string
lastUpdated string
metadata {[key: string]: string}
name string
projectId number
projectName string
regionId number
regionName string
snapshotId string
The ID of this resource.
volume_id This property is required. str
description str
last_updated str
metadata Mapping[str, str]
name str
project_id float
project_name str
region_id float
region_name str
snapshot_id str
The ID of this resource.
volumeId This property is required. String
description String
lastUpdated String
metadata Map<String>
name String
projectId Number
projectName String
regionId Number
regionName String
snapshotId String
The ID of this 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.
Size double
Status string
Id string
The provider-assigned unique ID for this managed resource.
Size float64
Status string
id String
The provider-assigned unique ID for this managed resource.
size Double
status String
id string
The provider-assigned unique ID for this managed resource.
size number
status string
id str
The provider-assigned unique ID for this managed resource.
size float
status str
id String
The provider-assigned unique ID for this managed resource.
size Number
status String

Look up 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
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        last_updated: Optional[str] = None,
        metadata: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        project_id: Optional[float] = None,
        project_name: Optional[str] = None,
        region_id: Optional[float] = None,
        region_name: Optional[str] = None,
        size: Optional[float] = None,
        snapshot_id: Optional[str] = None,
        status: Optional[str] = None,
        volume_id: Optional[str] = None) -> Snapshot
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)
public static Snapshot get(String name, Output<String> id, SnapshotState state, CustomResourceOptions options)
resources:  _:    type: gcorelabs:Snapshot    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Description string
LastUpdated string
Metadata Dictionary<string, string>
Name string
ProjectId double
ProjectName string
RegionId double
RegionName string
Size double
SnapshotId string
The ID of this resource.
Status string
VolumeId string
Description string
LastUpdated string
Metadata map[string]string
Name string
ProjectId float64
ProjectName string
RegionId float64
RegionName string
Size float64
SnapshotId string
The ID of this resource.
Status string
VolumeId string
description String
lastUpdated String
metadata Map<String,String>
name String
projectId Double
projectName String
regionId Double
regionName String
size Double
snapshotId String
The ID of this resource.
status String
volumeId String
description string
lastUpdated string
metadata {[key: string]: string}
name string
projectId number
projectName string
regionId number
regionName string
size number
snapshotId string
The ID of this resource.
status string
volumeId string
description str
last_updated str
metadata Mapping[str, str]
name str
project_id float
project_name str
region_id float
region_name str
size float
snapshot_id str
The ID of this resource.
status str
volume_id str
description String
lastUpdated String
metadata Map<String>
name String
projectId Number
projectName String
regionId Number
regionName String
size Number
snapshotId String
The ID of this resource.
status String
volumeId String

Import

import using <project_id>:<region_id>:<snapshot_id> format

$ pulumi import gcorelabs:index/snapshot:Snapshot snapshot1 1:6:447d2959-8ae0-4ca0-8d47-9f050a3637d7
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
gcorelabs g-core/terraform-provider-gcorelabs
License
Notes
This Pulumi package is based on the gcorelabs Terraform Provider.