1. Packages
  2. DigitalOcean
  3. API Docs
  4. DropletSnapshot
DigitalOcean v4.30.2 published on Wednesday, Jun 5, 2024 by Pulumi

digitalocean.DropletSnapshot

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.30.2 published on Wednesday, Jun 5, 2024 by Pulumi

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

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const web = new digitalocean.Droplet("web", {
        name: "web-01",
        size: digitalocean.DropletSlug.DropletS1VCPU1GB,
        image: "ubuntu-22-04-x64",
        region: digitalocean.Region.NYC3,
    });
    const web_snapshot = new digitalocean.DropletSnapshot("web-snapshot", {
        dropletId: web.id,
        name: "web-snapshot-01",
    });
    const from_snapshot = new digitalocean.Droplet("from-snapshot", {
        image: web_snapshot.id,
        name: "web-02",
        region: digitalocean.Region.NYC3,
        size: digitalocean.DropletSlug.DropletS2VCPU4GB,
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    web = digitalocean.Droplet("web",
        name="web-01",
        size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
        image="ubuntu-22-04-x64",
        region=digitalocean.Region.NYC3)
    web_snapshot = digitalocean.DropletSnapshot("web-snapshot",
        droplet_id=web.id,
        name="web-snapshot-01")
    from_snapshot = digitalocean.Droplet("from-snapshot",
        image=web_snapshot.id,
        name="web-02",
        region=digitalocean.Region.NYC3,
        size=digitalocean.DropletSlug.DROPLET_S2_VCPU4_GB)
    
    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{
    			Name:   pulumi.String("web-01"),
    			Size:   pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
    			Image:  pulumi.String("ubuntu-22-04-x64"),
    			Region: pulumi.String(digitalocean.RegionNYC3),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDropletSnapshot(ctx, "web-snapshot", &digitalocean.DropletSnapshotArgs{
    			DropletId: web.ID(),
    			Name:      pulumi.String("web-snapshot-01"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = digitalocean.NewDroplet(ctx, "from-snapshot", &digitalocean.DropletArgs{
    			Image:  web_snapshot.ID(),
    			Name:   pulumi.String("web-02"),
    			Region: pulumi.String(digitalocean.RegionNYC3),
    			Size:   pulumi.String(digitalocean.DropletSlugDropletS2VCPU4GB),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var web = new DigitalOcean.Droplet("web", new()
        {
            Name = "web-01",
            Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
            Image = "ubuntu-22-04-x64",
            Region = DigitalOcean.Region.NYC3,
        });
    
        var web_snapshot = new DigitalOcean.DropletSnapshot("web-snapshot", new()
        {
            DropletId = web.Id,
            Name = "web-snapshot-01",
        });
    
        var from_snapshot = new DigitalOcean.Droplet("from-snapshot", new()
        {
            Image = web_snapshot.Id,
            Name = "web-02",
            Region = DigitalOcean.Region.NYC3,
            Size = DigitalOcean.DropletSlug.DropletS2VCPU4GB,
        });
    
    });
    
    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()
                .name("web-01")
                .size("s-1vcpu-1gb")
                .image("ubuntu-22-04-x64")
                .region("nyc3")
                .build());
    
            var web_snapshot = new DropletSnapshot("web-snapshot", DropletSnapshotArgs.builder()
                .dropletId(web.id())
                .name("web-snapshot-01")
                .build());
    
            var from_snapshot = new Droplet("from-snapshot", DropletArgs.builder()
                .image(web_snapshot.id())
                .name("web-02")
                .region("nyc3")
                .size("s-2vcpu-4gb")
                .build());
    
        }
    }
    
    resources:
      web:
        type: digitalocean:Droplet
        properties:
          name: web-01
          size: s-1vcpu-1gb
          image: ubuntu-22-04-x64
          region: nyc3
      web-snapshot:
        type: digitalocean:DropletSnapshot
        properties:
          dropletId: ${web.id}
          name: web-snapshot-01
      from-snapshot:
        type: digitalocean:Droplet
        properties:
          image: ${["web-snapshot"].id}
          name: web-02
          region: nyc3
          size: s-2vcpu-4gb
    

    Create DropletSnapshot Resource

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

    Constructor syntax

    new DropletSnapshot(name: string, args: DropletSnapshotArgs, opts?: CustomResourceOptions);
    @overload
    def DropletSnapshot(resource_name: str,
                        args: DropletSnapshotArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def DropletSnapshot(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        droplet_id: Optional[str] = None,
                        name: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

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

    var dropletSnapshotResource = new DigitalOcean.DropletSnapshot("dropletSnapshotResource", new()
    {
        DropletId = "string",
        Name = "string",
    });
    
    example, err := digitalocean.NewDropletSnapshot(ctx, "dropletSnapshotResource", &digitalocean.DropletSnapshotArgs{
    	DropletId: pulumi.String("string"),
    	Name:      pulumi.String("string"),
    })
    
    var dropletSnapshotResource = new DropletSnapshot("dropletSnapshotResource", DropletSnapshotArgs.builder()
        .dropletId("string")
        .name("string")
        .build());
    
    droplet_snapshot_resource = digitalocean.DropletSnapshot("dropletSnapshotResource",
        droplet_id="string",
        name="string")
    
    const dropletSnapshotResource = new digitalocean.DropletSnapshot("dropletSnapshotResource", {
        dropletId: "string",
        name: "string",
    });
    
    type: digitalocean:DropletSnapshot
    properties:
        dropletId: string
        name: string
    

    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
    

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

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.30.2 published on Wednesday, Jun 5, 2024 by Pulumi