DigitalOcean

v4.16.0 published on Wednesday, Sep 28, 2022 by Pulumi

DropletSnapshot

Provides a resource which can be used to create a snapshot from an existing DigitalOcean Droplet.

Example Usage

using System.Collections.Generic;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

return await Deployment.RunAsync(() => 
{
    var web = new DigitalOcean.Droplet("web", new()
    {
        Size = "s-1vcpu-1gb",
        Image = "ubuntu-22-04-x64",
        Region = "nyc3",
    });

    var web_snapshot = new DigitalOcean.DropletSnapshot("web-snapshot", new()
    {
        DropletId = web.Id,
    });

    var from_snapshot = new DigitalOcean.Droplet("from-snapshot", new()
    {
        Image = web_snapshot.Id,
        Region = "nyc3",
        Size = "s-2vcpu-4gb",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		web, err := digitalocean.NewDroplet(ctx, "web", &digitalocean.DropletArgs{
			Size:   pulumi.String("s-1vcpu-1gb"),
			Image:  pulumi.String("ubuntu-22-04-x64"),
			Region: pulumi.String("nyc3"),
		})
		if err != nil {
			return err
		}
		_, err = digitalocean.NewDropletSnapshot(ctx, "web-snapshot", &digitalocean.DropletSnapshotArgs{
			DropletId: web.ID(),
		})
		if err != nil {
			return err
		}
		_, err = digitalocean.NewDroplet(ctx, "from-snapshot", &digitalocean.DropletArgs{
			Image:  web_snapshot.ID(),
			Region: pulumi.String("nyc3"),
			Size:   pulumi.String("s-2vcpu-4gb"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import com.pulumi.digitalocean.DropletSnapshot;
import com.pulumi.digitalocean.DropletSnapshotArgs;
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 web = new Droplet("web", DropletArgs.builder()        
            .size("s-1vcpu-1gb")
            .image("ubuntu-22-04-x64")
            .region("nyc3")
            .build());

        var web_snapshot = new DropletSnapshot("web-snapshot", DropletSnapshotArgs.builder()        
            .dropletId(web.id())
            .build());

        var from_snapshot = new Droplet("from-snapshot", DropletArgs.builder()        
            .image(web_snapshot.id())
            .region("nyc3")
            .size("s-2vcpu-4gb")
            .build());

    }
}
import pulumi
import pulumi_digitalocean as digitalocean

web = digitalocean.Droplet("web",
    size="s-1vcpu-1gb",
    image="ubuntu-22-04-x64",
    region="nyc3")
web_snapshot = digitalocean.DropletSnapshot("web-snapshot", droplet_id=web.id)
from_snapshot = digitalocean.Droplet("from-snapshot",
    image=web_snapshot.id,
    region="nyc3",
    size="s-2vcpu-4gb")
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const web = new digitalocean.Droplet("web", {
    size: "s-1vcpu-1gb",
    image: "ubuntu-22-04-x64",
    region: "nyc3",
});
const web_snapshot = new digitalocean.DropletSnapshot("web-snapshot", {dropletId: web.id});
const from_snapshot = new digitalocean.Droplet("from-snapshot", {
    image: web_snapshot.id,
    region: "nyc3",
    size: "s-2vcpu-4gb",
});
resources:
  web:
    type: digitalocean:Droplet
    properties:
      size: s-1vcpu-1gb
      image: ubuntu-22-04-x64
      region: nyc3
  web-snapshot:
    type: digitalocean:DropletSnapshot
    properties:
      dropletId: ${web.id}
  from-snapshot:
    type: digitalocean:Droplet
    properties:
      image: ${["web-snapshot"].id}
      region: nyc3
      size: s-2vcpu-4gb

Create DropletSnapshot Resource

new DropletSnapshot(name: string, args: DropletSnapshotArgs, opts?: CustomResourceOptions);
@overload
def DropletSnapshot(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    droplet_id: Optional[str] = None,
                    name: Optional[str] = None)
@overload
def DropletSnapshot(resource_name: str,
                    args: DropletSnapshotArgs,
                    opts: Optional[ResourceOptions] = None)
func NewDropletSnapshot(ctx *Context, name string, args DropletSnapshotArgs, opts ...ResourceOption) (*DropletSnapshot, error)
public DropletSnapshot(string name, DropletSnapshotArgs args, CustomResourceOptions? opts = null)
public DropletSnapshot(String name, DropletSnapshotArgs args)
public DropletSnapshot(String name, DropletSnapshotArgs args, CustomResourceOptions options)
type: digitalocean:DropletSnapshot
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

DropletSnapshot Resource Properties

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

Inputs

The DropletSnapshot resource accepts the following input properties:

DropletId string

The ID of the Droplet from which the snapshot will be taken.

Name string

A name for the Droplet snapshot.

DropletId string

The ID of the Droplet from which the snapshot will be taken.

Name string

A name for the Droplet snapshot.

dropletId String

The ID of the Droplet from which the snapshot will be taken.

name String

A name for the Droplet snapshot.

dropletId string

The ID of the Droplet from which the snapshot will be taken.

name string

A name for the Droplet snapshot.

droplet_id str

The ID of the Droplet from which the snapshot will be taken.

name str

A name for the Droplet snapshot.

dropletId String

The ID of the Droplet from which the snapshot will be taken.

name String

A name for the Droplet snapshot.

Outputs

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

CreatedAt string

The date and time the Droplet snapshot was created.

Id string

The provider-assigned unique ID for this managed resource.

MinDiskSize int

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

Regions List<string>

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

Size double

The billable size of the Droplet snapshot in gigabytes.

CreatedAt string

The date and time the Droplet snapshot was created.

Id string

The provider-assigned unique ID for this managed resource.

MinDiskSize int

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

Regions []string

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

Size float64

The billable size of the Droplet snapshot in gigabytes.

createdAt String

The date and time the Droplet snapshot was created.

id String

The provider-assigned unique ID for this managed resource.

minDiskSize Integer

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

regions List<String>

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size Double

The billable size of the Droplet snapshot in gigabytes.

createdAt string

The date and time the Droplet snapshot was created.

id string

The provider-assigned unique ID for this managed resource.

minDiskSize number

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

regions string[]

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size number

The billable size of the Droplet snapshot in gigabytes.

created_at str

The date and time the Droplet snapshot was created.

id str

The provider-assigned unique ID for this managed resource.

min_disk_size int

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

regions Sequence[str]

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size float

The billable size of the Droplet snapshot in gigabytes.

createdAt String

The date and time the Droplet snapshot was created.

id String

The provider-assigned unique ID for this managed resource.

minDiskSize Number

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

regions List<String>

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size Number

The billable size of the Droplet snapshot in gigabytes.

Look up Existing DropletSnapshot Resource

Get an existing DropletSnapshot 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?: DropletSnapshotState, opts?: CustomResourceOptions): DropletSnapshot
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        created_at: Optional[str] = None,
        droplet_id: Optional[str] = None,
        min_disk_size: Optional[int] = None,
        name: Optional[str] = None,
        regions: Optional[Sequence[str]] = None,
        size: Optional[float] = None) -> DropletSnapshot
func GetDropletSnapshot(ctx *Context, name string, id IDInput, state *DropletSnapshotState, opts ...ResourceOption) (*DropletSnapshot, error)
public static DropletSnapshot Get(string name, Input<string> id, DropletSnapshotState? state, CustomResourceOptions? opts = null)
public static DropletSnapshot get(String name, Output<String> id, DropletSnapshotState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
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.
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:
CreatedAt string

The date and time the Droplet snapshot was created.

DropletId string

The ID of the Droplet from which the snapshot will be taken.

MinDiskSize int

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

Name string

A name for the Droplet snapshot.

Regions List<string>

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

Size double

The billable size of the Droplet snapshot in gigabytes.

CreatedAt string

The date and time the Droplet snapshot was created.

DropletId string

The ID of the Droplet from which the snapshot will be taken.

MinDiskSize int

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

Name string

A name for the Droplet snapshot.

Regions []string

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

Size float64

The billable size of the Droplet snapshot in gigabytes.

createdAt String

The date and time the Droplet snapshot was created.

dropletId String

The ID of the Droplet from which the snapshot will be taken.

minDiskSize Integer

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

name String

A name for the Droplet snapshot.

regions List<String>

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size Double

The billable size of the Droplet snapshot in gigabytes.

createdAt string

The date and time the Droplet snapshot was created.

dropletId string

The ID of the Droplet from which the snapshot will be taken.

minDiskSize number

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

name string

A name for the Droplet snapshot.

regions string[]

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size number

The billable size of the Droplet snapshot in gigabytes.

created_at str

The date and time the Droplet snapshot was created.

droplet_id str

The ID of the Droplet from which the snapshot will be taken.

min_disk_size int

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

name str

A name for the Droplet snapshot.

regions Sequence[str]

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size float

The billable size of the Droplet snapshot in gigabytes.

createdAt String

The date and time the Droplet snapshot was created.

dropletId String

The ID of the Droplet from which the snapshot will be taken.

minDiskSize Number

The minimum size in gigabytes required for a Droplet to be created based on this snapshot.

name String

A name for the Droplet snapshot.

regions List<String>

A list of DigitalOcean region "slugs" indicating where the droplet snapshot is available.

size Number

The billable size of the Droplet snapshot in gigabytes.

Import

Droplet Snapshots can be imported using the snapshot id, e.g.

 $ pulumi import digitalocean:index/dropletSnapshot:DropletSnapshot mysnapshot 123456

Package Details

Repository
https://github.com/pulumi/pulumi-digitalocean
License
Apache-2.0
Notes

This Pulumi package is based on the digitalocean Terraform Provider.