1. Packages
  2. Vultr
  3. API Docs
  4. Snapshot
Vultr v2.23.1 published on Tuesday, Dec 10, 2024 by dirien

vultr.Snapshot

Explore with Pulumi AI

Provides a Vultr Snapshot resource. This can be used to create, read, modify, and delete Snapshot.

Example Usage

Create a new Snapshot

import * as pulumi from "@pulumi/pulumi";
import * as vultr from "@ediri/vultr";

const myInstance = new vultr.Instance("myInstance", {
    label: "my_instance",
    osId: 167,
    plan: "201",
    region: "ewr",
});
const mySnapshot = new vultr.Snapshot("mySnapshot", {
    description: "my instances snapshot",
    instanceId: myInstance.id,
});
Copy
import pulumi
import ediri_vultr as vultr

my_instance = vultr.Instance("myInstance",
    label="my_instance",
    os_id=167,
    plan="201",
    region="ewr")
my_snapshot = vultr.Snapshot("mySnapshot",
    description="my instances snapshot",
    instance_id=my_instance.id)
Copy
package main

import (
	"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		myInstance, err := vultr.NewInstance(ctx, "myInstance", &vultr.InstanceArgs{
			Label:  pulumi.String("my_instance"),
			OsId:   pulumi.Int(167),
			Plan:   pulumi.String("201"),
			Region: pulumi.String("ewr"),
		})
		if err != nil {
			return err
		}
		_, err = vultr.NewSnapshot(ctx, "mySnapshot", &vultr.SnapshotArgs{
			Description: pulumi.String("my instances snapshot"),
			InstanceId:  myInstance.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vultr = ediri.Vultr;

return await Deployment.RunAsync(() => 
{
    var myInstance = new Vultr.Instance("myInstance", new()
    {
        Label = "my_instance",
        OsId = 167,
        Plan = "201",
        Region = "ewr",
    });

    var mySnapshot = new Vultr.Snapshot("mySnapshot", new()
    {
        Description = "my instances snapshot",
        InstanceId = myInstance.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vultr.Instance;
import com.pulumi.vultr.InstanceArgs;
import com.pulumi.vultr.Snapshot;
import com.pulumi.vultr.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 myInstance = new Instance("myInstance", InstanceArgs.builder()
            .label("my_instance")
            .osId(167)
            .plan(201)
            .region("ewr")
            .build());

        var mySnapshot = new Snapshot("mySnapshot", SnapshotArgs.builder()
            .description("my instances snapshot")
            .instanceId(myInstance.id())
            .build());

    }
}
Copy
resources:
  myInstance:
    type: vultr:Instance
    properties:
      label: my_instance
      osId: 167
      plan: 201
      region: ewr
  mySnapshot:
    type: vultr:Snapshot
    properties:
      description: my instances snapshot
      instanceId: ${myInstance.id}
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,
             instance_id: Optional[str] = None,
             description: 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: vultr: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 Vultr.Snapshot("snapshotResource", new()
{
    InstanceId = "string",
    Description = "string",
});
Copy
example, err := vultr.NewSnapshot(ctx, "snapshotResource", &vultr.SnapshotArgs{
	InstanceId:  pulumi.String("string"),
	Description: pulumi.String("string"),
})
Copy
var snapshotResource = new Snapshot("snapshotResource", SnapshotArgs.builder()
    .instanceId("string")
    .description("string")
    .build());
Copy
snapshot_resource = vultr.Snapshot("snapshotResource",
    instance_id="string",
    description="string")
Copy
const snapshotResource = new vultr.Snapshot("snapshotResource", {
    instanceId: "string",
    description: "string",
});
Copy
type: vultr:Snapshot
properties:
    description: string
    instanceId: 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:

InstanceId
This property is required.
Changes to this property will trigger replacement.
string
ID of a given instance that you want to create a snapshot from.
Description Changes to this property will trigger replacement. string

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

InstanceId
This property is required.
Changes to this property will trigger replacement.
string
ID of a given instance that you want to create a snapshot from.
Description Changes to this property will trigger replacement. string

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instanceId
This property is required.
Changes to this property will trigger replacement.
String
ID of a given instance that you want to create a snapshot from.
description Changes to this property will trigger replacement. String

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instanceId
This property is required.
Changes to this property will trigger replacement.
string
ID of a given instance that you want to create a snapshot from.
description Changes to this property will trigger replacement. string

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instance_id
This property is required.
Changes to this property will trigger replacement.
str
ID of a given instance that you want to create a snapshot from.
description Changes to this property will trigger replacement. str

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instanceId
This property is required.
Changes to this property will trigger replacement.
String
ID of a given instance that you want to create a snapshot from.
description Changes to this property will trigger replacement. String

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

Outputs

All input properties are implicitly available as output properties. Additionally, the Snapshot resource produces the following output properties:

AppId int
The app id which the snapshot is associated with.
DateCreated string
The date the snapshot was created.
Id string
The provider-assigned unique ID for this managed resource.
OsId int
The os id which the snapshot is associated with.
Size int
The size of the snapshot in Bytes.
Status string
The status for the given snapshot.
AppId int
The app id which the snapshot is associated with.
DateCreated string
The date the snapshot was created.
Id string
The provider-assigned unique ID for this managed resource.
OsId int
The os id which the snapshot is associated with.
Size int
The size of the snapshot in Bytes.
Status string
The status for the given snapshot.
appId Integer
The app id which the snapshot is associated with.
dateCreated String
The date the snapshot was created.
id String
The provider-assigned unique ID for this managed resource.
osId Integer
The os id which the snapshot is associated with.
size Integer
The size of the snapshot in Bytes.
status String
The status for the given snapshot.
appId number
The app id which the snapshot is associated with.
dateCreated string
The date the snapshot was created.
id string
The provider-assigned unique ID for this managed resource.
osId number
The os id which the snapshot is associated with.
size number
The size of the snapshot in Bytes.
status string
The status for the given snapshot.
app_id int
The app id which the snapshot is associated with.
date_created str
The date the snapshot was created.
id str
The provider-assigned unique ID for this managed resource.
os_id int
The os id which the snapshot is associated with.
size int
The size of the snapshot in Bytes.
status str
The status for the given snapshot.
appId Number
The app id which the snapshot is associated with.
dateCreated String
The date the snapshot was created.
id String
The provider-assigned unique ID for this managed resource.
osId Number
The os id which the snapshot is associated with.
size Number
The size of the snapshot in Bytes.
status String
The status for the given snapshot.

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,
        app_id: Optional[int] = None,
        date_created: Optional[str] = None,
        description: Optional[str] = None,
        instance_id: Optional[str] = None,
        os_id: Optional[int] = None,
        size: Optional[int] = None,
        status: 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: vultr: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:
AppId int
The app id which the snapshot is associated with.
DateCreated string
The date the snapshot was created.
Description Changes to this property will trigger replacement. string

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

InstanceId Changes to this property will trigger replacement. string
ID of a given instance that you want to create a snapshot from.
OsId int
The os id which the snapshot is associated with.
Size int
The size of the snapshot in Bytes.
Status string
The status for the given snapshot.
AppId int
The app id which the snapshot is associated with.
DateCreated string
The date the snapshot was created.
Description Changes to this property will trigger replacement. string

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

InstanceId Changes to this property will trigger replacement. string
ID of a given instance that you want to create a snapshot from.
OsId int
The os id which the snapshot is associated with.
Size int
The size of the snapshot in Bytes.
Status string
The status for the given snapshot.
appId Integer
The app id which the snapshot is associated with.
dateCreated String
The date the snapshot was created.
description Changes to this property will trigger replacement. String

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instanceId Changes to this property will trigger replacement. String
ID of a given instance that you want to create a snapshot from.
osId Integer
The os id which the snapshot is associated with.
size Integer
The size of the snapshot in Bytes.
status String
The status for the given snapshot.
appId number
The app id which the snapshot is associated with.
dateCreated string
The date the snapshot was created.
description Changes to this property will trigger replacement. string

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instanceId Changes to this property will trigger replacement. string
ID of a given instance that you want to create a snapshot from.
osId number
The os id which the snapshot is associated with.
size number
The size of the snapshot in Bytes.
status string
The status for the given snapshot.
app_id int
The app id which the snapshot is associated with.
date_created str
The date the snapshot was created.
description Changes to this property will trigger replacement. str

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instance_id Changes to this property will trigger replacement. str
ID of a given instance that you want to create a snapshot from.
os_id int
The os id which the snapshot is associated with.
size int
The size of the snapshot in Bytes.
status str
The status for the given snapshot.
appId Number
The app id which the snapshot is associated with.
dateCreated String
The date the snapshot was created.
description Changes to this property will trigger replacement. String

The description for the given snapshot.

Snapshots often exceed the default timeout built in to all create requests in the provider. In order to customize that, you may specify a custome value in a timeouts block of the resource definition

instanceId Changes to this property will trigger replacement. String
ID of a given instance that you want to create a snapshot from.
osId Number
The os id which the snapshot is associated with.
size Number
The size of the snapshot in Bytes.
status String
The status for the given snapshot.

Import

Snapshots can be imported using the Snapshot ID, e.g.

$ pulumi import vultr:index/snapshot:Snapshot my_snapshot 283941e8-0783-410e-9540-71c86b833992
Copy

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

Package Details

Repository
vultr dirien/pulumi-vultr
License
Apache-2.0
Notes
This Pulumi package is based on the vultr Terraform Provider.