VolumeArgs

data class VolumeArgs(val description: Output<String>? = null, val filesystemType: Output<String>? = null, val initialFilesystemLabel: Output<String>? = null, val initialFilesystemType: Output<Either<String, FileSystemType>>? = null, val name: Output<String>? = null, val region: Output<Either<String, Region>>? = null, val size: Output<Int>? = null, val snapshotId: Output<String>? = null, val tags: Output<List<String>>? = null) : ConvertibleToJava<VolumeArgs>

Provides a DigitalOcean Block Storage volume which can be attached to a Droplet in order to provide expanded storage.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const foobar = new digitalocean.Volume("foobar", {
region: digitalocean.Region.NYC1,
name: "baz",
size: 100,
initialFilesystemType: digitalocean.FileSystemType.EXT4,
description: "an example volume",
});
const foobarDroplet = new digitalocean.Droplet("foobar", {
name: "baz",
size: digitalocean.DropletSlug.DropletS1VCPU1GB,
image: "ubuntu-18-04-x64",
region: digitalocean.Region.NYC1,
});
const foobarVolumeAttachment = new digitalocean.VolumeAttachment("foobar", {
dropletId: foobarDroplet.id,
volumeId: foobar.id,
});
import pulumi
import pulumi_digitalocean as digitalocean
foobar = digitalocean.Volume("foobar",
region=digitalocean.Region.NYC1,
name="baz",
size=100,
initial_filesystem_type=digitalocean.FileSystemType.EXT4,
description="an example volume")
foobar_droplet = digitalocean.Droplet("foobar",
name="baz",
size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
image="ubuntu-18-04-x64",
region=digitalocean.Region.NYC1)
foobar_volume_attachment = digitalocean.VolumeAttachment("foobar",
droplet_id=foobar_droplet.id,
volume_id=foobar.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var foobar = new DigitalOcean.Volume("foobar", new()
{
Region = DigitalOcean.Region.NYC1,
Name = "baz",
Size = 100,
InitialFilesystemType = DigitalOcean.FileSystemType.EXT4,
Description = "an example volume",
});
var foobarDroplet = new DigitalOcean.Droplet("foobar", new()
{
Name = "baz",
Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
Image = "ubuntu-18-04-x64",
Region = DigitalOcean.Region.NYC1,
});
var foobarVolumeAttachment = new DigitalOcean.VolumeAttachment("foobar", new()
{
DropletId = foobarDroplet.Id,
VolumeId = foobar.Id,
});
});
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 {
foobar, err := digitalocean.NewVolume(ctx, "foobar", &digitalocean.VolumeArgs{
Region: pulumi.String(digitalocean.RegionNYC1),
Name: pulumi.String("baz"),
Size: pulumi.Int(100),
InitialFilesystemType: pulumi.String(digitalocean.FileSystemTypeEXT4),
Description: pulumi.String("an example volume"),
})
if err != nil {
return err
}
foobarDroplet, err := digitalocean.NewDroplet(ctx, "foobar", &digitalocean.DropletArgs{
Name: pulumi.String("baz"),
Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
Image: pulumi.String("ubuntu-18-04-x64"),
Region: pulumi.String(digitalocean.RegionNYC1),
})
if err != nil {
return err
}
_, err = digitalocean.NewVolumeAttachment(ctx, "foobar", &digitalocean.VolumeAttachmentArgs{
DropletId: foobarDroplet.ID(),
VolumeId: foobar.ID(),
})
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.Volume;
import com.pulumi.digitalocean.VolumeArgs;
import com.pulumi.digitalocean.Droplet;
import com.pulumi.digitalocean.DropletArgs;
import com.pulumi.digitalocean.VolumeAttachment;
import com.pulumi.digitalocean.VolumeAttachmentArgs;
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 foobar = new Volume("foobar", VolumeArgs.builder()
.region("nyc1")
.name("baz")
.size(100)
.initialFilesystemType("ext4")
.description("an example volume")
.build());
var foobarDroplet = new Droplet("foobarDroplet", DropletArgs.builder()
.name("baz")
.size("s-1vcpu-1gb")
.image("ubuntu-18-04-x64")
.region("nyc1")
.build());
var foobarVolumeAttachment = new VolumeAttachment("foobarVolumeAttachment", VolumeAttachmentArgs.builder()
.dropletId(foobarDroplet.id())
.volumeId(foobar.id())
.build());
}
}
resources:
foobar:
type: digitalocean:Volume
properties:
region: nyc1
name: baz
size: 100
initialFilesystemType: ext4
description: an example volume
foobarDroplet:
type: digitalocean:Droplet
name: foobar
properties:
name: baz
size: s-1vcpu-1gb
image: ubuntu-18-04-x64
region: nyc1
foobarVolumeAttachment:
type: digitalocean:VolumeAttachment
name: foobar
properties:
dropletId: ${foobarDroplet.id}
volumeId: ${foobar.id}

You can also create a volume from an existing snapshot.

import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";
const foobar = digitalocean.getVolumeSnapshot({
name: "baz",
});
const foobarVolume = new digitalocean.Volume("foobar", {
region: digitalocean.Region.LON1,
name: "foo",
size: foobar.then(foobar => foobar.minDiskSize),
snapshotId: foobar.then(foobar => foobar.id),
});
import pulumi
import pulumi_digitalocean as digitalocean
foobar = digitalocean.get_volume_snapshot(name="baz")
foobar_volume = digitalocean.Volume("foobar",
region=digitalocean.Region.LON1,
name="foo",
size=foobar.min_disk_size,
snapshot_id=foobar.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;
return await Deployment.RunAsync(() =>
{
var foobar = DigitalOcean.GetVolumeSnapshot.Invoke(new()
{
Name = "baz",
});
var foobarVolume = new DigitalOcean.Volume("foobar", new()
{
Region = DigitalOcean.Region.LON1,
Name = "foo",
Size = foobar.Apply(getVolumeSnapshotResult => getVolumeSnapshotResult.MinDiskSize),
SnapshotId = foobar.Apply(getVolumeSnapshotResult => getVolumeSnapshotResult.Id),
});
});
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 {
foobar, err := digitalocean.LookupVolumeSnapshot(ctx, &digitalocean.LookupVolumeSnapshotArgs{
Name: pulumi.StringRef("baz"),
}, nil)
if err != nil {
return err
}
_, err = digitalocean.NewVolume(ctx, "foobar", &digitalocean.VolumeArgs{
Region: pulumi.String(digitalocean.RegionLON1),
Name: pulumi.String("foo"),
Size: pulumi.Int(foobar.MinDiskSize),
SnapshotId: pulumi.String(foobar.Id),
})
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.DigitaloceanFunctions;
import com.pulumi.digitalocean.inputs.GetVolumeSnapshotArgs;
import com.pulumi.digitalocean.Volume;
import com.pulumi.digitalocean.VolumeArgs;
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) {
final var foobar = DigitaloceanFunctions.getVolumeSnapshot(GetVolumeSnapshotArgs.builder()
.name("baz")
.build());
var foobarVolume = new Volume("foobarVolume", VolumeArgs.builder()
.region("lon1")
.name("foo")
.size(foobar.minDiskSize())
.snapshotId(foobar.id())
.build());
}
}
resources:
foobarVolume:
type: digitalocean:Volume
name: foobar
properties:
region: lon1
name: foo
size: ${foobar.minDiskSize}
snapshotId: ${foobar.id}
variables:
foobar:
fn::invoke:
function: digitalocean:getVolumeSnapshot
arguments:
name: baz

Import

Volumes can be imported using the volume id, e.g.

$ pulumi import digitalocean:index/volume:Volume volume 506f78a4-e098-11e5-ad9f-000f53306ae1

Constructors

Link copied to clipboard
constructor(description: Output<String>? = null, filesystemType: Output<String>? = null, initialFilesystemLabel: Output<String>? = null, initialFilesystemType: Output<Either<String, FileSystemType>>? = null, name: Output<String>? = null, region: Output<Either<String, Region>>? = null, size: Output<Int>? = null, snapshotId: Output<String>? = null, tags: Output<List<String>>? = null)

Properties

Link copied to clipboard
val description: Output<String>? = null

A free-form text field up to a limit of 1024 bytes to describe a block storage volume.

Link copied to clipboard
val filesystemType: Output<String>? = null

Filesystem type (xfs or ext4) for the block storage volume.

Link copied to clipboard
val initialFilesystemLabel: Output<String>? = null

Initial filesystem label for the block storage volume.

Link copied to clipboard
val initialFilesystemType: Output<Either<String, FileSystemType>>? = null

Initial filesystem type (xfs or ext4) for the block storage volume.

Link copied to clipboard
val name: Output<String>? = null

A name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter.

Link copied to clipboard
val region: Output<Either<String, Region>>? = null

The region that the block storage volume will be created in.

Link copied to clipboard
val size: Output<Int>? = null

The size of the block storage volume in GiB. If updated, can only be expanded.

Link copied to clipboard
val snapshotId: Output<String>? = null

The ID of an existing volume snapshot from which the new volume will be created. If supplied, the region and size will be limited on creation to that of the referenced snapshot

Link copied to clipboard
val tags: Output<List<String>>? = null

A list of the tags to be applied to this Volume.

Functions

Link copied to clipboard
open override fun toJava(): VolumeArgs