linode.Volume
Explore with Pulumi AI
Provides a Linode Volume resource. This can be used to create, modify, and delete Linodes Block Storage Volumes. Block Storage Volumes are removable storage disks that persist outside the life-cycle of Linode Instances. These volumes can be attached to and detached from Linode instances throughout a region.
For more information, see How to Use Block Storage with Your Linode and the Linode APIv4 docs.
Example Usage
The following example shows how one might use this resource to configure a Block Storage Volume attached to a Linode Instance.
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var foobaz = new Linode.Instance("foobaz", new()
{
RootPass = "3X4mp13",
Type = "g6-nanode-1",
Region = "us-west",
Tags = new[]
{
"foobaz",
},
});
var foobar = new Linode.Volume("foobar", new()
{
Label = "foo-volume",
Region = foobaz.Region,
LinodeId = foobaz.Id,
});
});
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
foobaz, err := linode.NewInstance(ctx, "foobaz", &linode.InstanceArgs{
RootPass: pulumi.String("3X4mp13"),
Type: pulumi.String("g6-nanode-1"),
Region: pulumi.String("us-west"),
Tags: pulumi.StringArray{
pulumi.String("foobaz"),
},
})
if err != nil {
return err
}
_, err = linode.NewVolume(ctx, "foobar", &linode.VolumeArgs{
Label: pulumi.String("foo-volume"),
Region: foobaz.Region,
LinodeId: foobaz.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.linode.Instance;
import com.pulumi.linode.InstanceArgs;
import com.pulumi.linode.Volume;
import com.pulumi.linode.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) {
var foobaz = new Instance("foobaz", InstanceArgs.builder()
.rootPass("3X4mp13")
.type("g6-nanode-1")
.region("us-west")
.tags("foobaz")
.build());
var foobar = new Volume("foobar", VolumeArgs.builder()
.label("foo-volume")
.region(foobaz.region())
.linodeId(foobaz.id())
.build());
}
}
import pulumi
import pulumi_linode as linode
foobaz = linode.Instance("foobaz",
root_pass="3X4mp13",
type="g6-nanode-1",
region="us-west",
tags=["foobaz"])
foobar = linode.Volume("foobar",
label="foo-volume",
region=foobaz.region,
linode_id=foobaz.id)
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const foobaz = new linode.Instance("foobaz", {
rootPass: "3X4mp13",
type: "g6-nanode-1",
region: "us-west",
tags: ["foobaz"],
});
const foobar = new linode.Volume("foobar", {
label: "foo-volume",
region: foobaz.region,
linodeId: foobaz.id,
});
resources:
foobaz:
type: linode:Instance
properties:
rootPass: 3X4mp13
type: g6-nanode-1
region: us-west
tags:
- foobaz
foobar:
type: linode:Volume
properties:
label: foo-volume
region: ${foobaz.region}
linodeId: ${foobaz.id}
Volumes can also be attached using the Linode Instance config device map.
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var foo = new Linode.Instance("foo", new()
{
Configs = new[]
{
new Linode.Inputs.InstanceConfigArgs
{
Devices = new Linode.Inputs.InstanceConfigDevicesArgs
{
Sda = new Linode.Inputs.InstanceConfigDevicesSdaArgs
{
VolumeId = 123,
},
},
Kernel = "linode/latest-64bit",
Label = "boot-existing-volume",
},
},
Region = "us-east",
Type = "g6-nanode-1",
});
});
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := linode.NewInstance(ctx, "foo", &linode.InstanceArgs{
Configs: linode.InstanceConfigArray{
&linode.InstanceConfigArgs{
Devices: &linode.InstanceConfigDevicesArgs{
Sda: &linode.InstanceConfigDevicesSdaArgs{
VolumeId: pulumi.Int(123),
},
},
Kernel: pulumi.String("linode/latest-64bit"),
Label: pulumi.String("boot-existing-volume"),
},
},
Region: pulumi.String("us-east"),
Type: pulumi.String("g6-nanode-1"),
})
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.linode.Instance;
import com.pulumi.linode.InstanceArgs;
import com.pulumi.linode.inputs.InstanceConfigArgs;
import com.pulumi.linode.inputs.InstanceConfigDevicesArgs;
import com.pulumi.linode.inputs.InstanceConfigDevicesSdaArgs;
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 foo = new Instance("foo", InstanceArgs.builder()
.configs(InstanceConfigArgs.builder()
.devices(InstanceConfigDevicesArgs.builder()
.sda(InstanceConfigDevicesSdaArgs.builder()
.volumeId("123")
.build())
.build())
.kernel("linode/latest-64bit")
.label("boot-existing-volume")
.build())
.region("us-east")
.type("g6-nanode-1")
.build());
}
}
import pulumi
import pulumi_linode as linode
foo = linode.Instance("foo",
configs=[linode.InstanceConfigArgs(
devices=linode.InstanceConfigDevicesArgs(
sda=linode.InstanceConfigDevicesSdaArgs(
volume_id=123,
),
),
kernel="linode/latest-64bit",
label="boot-existing-volume",
)],
region="us-east",
type="g6-nanode-1")
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const foo = new linode.Instance("foo", {
configs: [{
devices: {
sda: {
volumeId: 123,
},
},
kernel: "linode/latest-64bit",
label: "boot-existing-volume",
}],
region: "us-east",
type: "g6-nanode-1",
});
resources:
foo:
type: linode:Instance
properties:
configs:
- devices:
sda:
volumeId: '123'
kernel: linode/latest-64bit
label: boot-existing-volume
region: us-east
type: g6-nanode-1
Volumes may also be cloned from existing volumes.
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Linode = Pulumi.Linode;
return await Deployment.RunAsync(() =>
{
var foobar = new Linode.Volume("foobar", new()
{
Label = "my-cloned-volume",
SourceVolumeId = 12345,
});
});
package main
import (
"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := linode.NewVolume(ctx, "foobar", &linode.VolumeArgs{
Label: pulumi.String("my-cloned-volume"),
SourceVolumeId: pulumi.Int(12345),
})
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.linode.Volume;
import com.pulumi.linode.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) {
var foobar = new Volume("foobar", VolumeArgs.builder()
.label("my-cloned-volume")
.sourceVolumeId(12345)
.build());
}
}
import pulumi
import pulumi_linode as linode
foobar = linode.Volume("foobar",
label="my-cloned-volume",
source_volume_id=12345)
import * as pulumi from "@pulumi/pulumi";
import * as linode from "@pulumi/linode";
const foobar = new linode.Volume("foobar", {
label: "my-cloned-volume",
sourceVolumeId: 12345,
});
resources:
foobar:
type: linode:Volume
properties:
label: my-cloned-volume
sourceVolumeId: 12345
Create Volume Resource
new Volume(name: string, args: VolumeArgs, opts?: CustomResourceOptions);
@overload
def Volume(resource_name: str,
opts: Optional[ResourceOptions] = None,
label: Optional[str] = None,
linode_id: Optional[int] = None,
region: Optional[str] = None,
size: Optional[int] = None,
source_volume_id: Optional[int] = None,
tags: Optional[Sequence[str]] = None)
@overload
def Volume(resource_name: str,
args: VolumeArgs,
opts: Optional[ResourceOptions] = None)
func NewVolume(ctx *Context, name string, args VolumeArgs, opts ...ResourceOption) (*Volume, error)
public Volume(string name, VolumeArgs args, CustomResourceOptions? opts = null)
public Volume(String name, VolumeArgs args)
public Volume(String name, VolumeArgs args, CustomResourceOptions options)
type: linode:Volume
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VolumeArgs
- 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 VolumeArgs
- 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 VolumeArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VolumeArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VolumeArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Volume 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 Volume resource accepts the following input properties:
- Label string
The label of the Linode Volume
- Linode
Id int The ID of a Linode Instance where the Volume should be attached.
- Region string
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- Size int
Size of the Volume in GB.
- Source
Volume intId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- List<string>
A list of tags applied to this object. Tags are for organizational purposes only.
- Label string
The label of the Linode Volume
- Linode
Id int The ID of a Linode Instance where the Volume should be attached.
- Region string
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- Size int
Size of the Volume in GB.
- Source
Volume intId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- []string
A list of tags applied to this object. Tags are for organizational purposes only.
- label String
The label of the Linode Volume
- linode
Id Integer The ID of a Linode Instance where the Volume should be attached.
- region String
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size Integer
Size of the Volume in GB.
- source
Volume IntegerId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- List<String>
A list of tags applied to this object. Tags are for organizational purposes only.
- label string
The label of the Linode Volume
- linode
Id number The ID of a Linode Instance where the Volume should be attached.
- region string
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size number
Size of the Volume in GB.
- source
Volume numberId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- string[]
A list of tags applied to this object. Tags are for organizational purposes only.
- label str
The label of the Linode Volume
- linode_
id int The ID of a Linode Instance where the Volume should be attached.
- region str
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size int
Size of the Volume in GB.
- source_
volume_ intid The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- Sequence[str]
A list of tags applied to this object. Tags are for organizational purposes only.
- label String
The label of the Linode Volume
- linode
Id Number The ID of a Linode Instance where the Volume should be attached.
- region String
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size Number
Size of the Volume in GB.
- source
Volume NumberId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- List<String>
A list of tags applied to this object. Tags are for organizational purposes only.
Outputs
All input properties are implicitly available as output properties. Additionally, the Volume resource produces the following output properties:
- Filesystem
Path string The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- Id string
The provider-assigned unique ID for this managed resource.
- Status string
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)
- Filesystem
Path string The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- Id string
The provider-assigned unique ID for this managed resource.
- Status string
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)
- filesystem
Path String The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- id String
The provider-assigned unique ID for this managed resource.
- status String
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)
- filesystem
Path string The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- id string
The provider-assigned unique ID for this managed resource.
- status string
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)
- filesystem_
path str The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- id str
The provider-assigned unique ID for this managed resource.
- status str
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)
- filesystem
Path String The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- id String
The provider-assigned unique ID for this managed resource.
- status String
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)
Look up Existing Volume Resource
Get an existing Volume 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?: VolumeState, opts?: CustomResourceOptions): Volume
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
filesystem_path: Optional[str] = None,
label: Optional[str] = None,
linode_id: Optional[int] = None,
region: Optional[str] = None,
size: Optional[int] = None,
source_volume_id: Optional[int] = None,
status: Optional[str] = None,
tags: Optional[Sequence[str]] = None) -> Volume
func GetVolume(ctx *Context, name string, id IDInput, state *VolumeState, opts ...ResourceOption) (*Volume, error)
public static Volume Get(string name, Input<string> id, VolumeState? state, CustomResourceOptions? opts = null)
public static Volume get(String name, Output<String> id, VolumeState 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.
- Filesystem
Path string The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- Label string
The label of the Linode Volume
- Linode
Id int The ID of a Linode Instance where the Volume should be attached.
- Region string
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- Size int
Size of the Volume in GB.
- Source
Volume intId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- Status string
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)- List<string>
A list of tags applied to this object. Tags are for organizational purposes only.
- Filesystem
Path string The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- Label string
The label of the Linode Volume
- Linode
Id int The ID of a Linode Instance where the Volume should be attached.
- Region string
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- Size int
Size of the Volume in GB.
- Source
Volume intId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- Status string
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)- []string
A list of tags applied to this object. Tags are for organizational purposes only.
- filesystem
Path String The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- label String
The label of the Linode Volume
- linode
Id Integer The ID of a Linode Instance where the Volume should be attached.
- region String
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size Integer
Size of the Volume in GB.
- source
Volume IntegerId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- status String
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)- List<String>
A list of tags applied to this object. Tags are for organizational purposes only.
- filesystem
Path string The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- label string
The label of the Linode Volume
- linode
Id number The ID of a Linode Instance where the Volume should be attached.
- region string
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size number
Size of the Volume in GB.
- source
Volume numberId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- status string
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)- string[]
A list of tags applied to this object. Tags are for organizational purposes only.
- filesystem_
path str The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- label str
The label of the Linode Volume
- linode_
id int The ID of a Linode Instance where the Volume should be attached.
- region str
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size int
Size of the Volume in GB.
- source_
volume_ intid The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- status str
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)- Sequence[str]
A list of tags applied to this object. Tags are for organizational purposes only.
- filesystem
Path String The full filesystem path for the Volume based on the Volume's label. The path is "/dev/disk/by-id/scsi-0Linode_Volume_" + the Volume label
- label String
The label of the Linode Volume
- linode
Id Number The ID of a Linode Instance where the Volume should be attached.
- region String
The region where this volume will be deployed. Examples are
"us-east"
,"us-west"
,"ap-south"
, etc. See all regions here. This field is optional for cloned volumes. Changingregion
forces the creation of a new Linode Volume..- size Number
Size of the Volume in GB.
- source
Volume NumberId The ID of a Linode Volume to clone. NOTE: Cloned volumes must be in the same region as the source volume.
- status String
The status of the Linode Volume. (
creating
,active
,resizing
,contact_support
)- List<String>
A list of tags applied to this object. Tags are for organizational purposes only.
Import
Linodes Volumes can be imported using the Linode Volume id
, e.g.
$ pulumi import linode:index/volume:Volume myvolume 1234567
The Linode Guide, Import Existing Infrastructure to Terraform, offers resource importing examples for Block Storage Volumes and other Linode resource types.
Package Details
- Repository
- Linode pulumi/pulumi-linode
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
linode
Terraform Provider.