Attaching an existing volume with Terraform

Linode Staff

Is it possible to attach an existing volume to a Linode upon deployment? Also, what is the best way to obtain the volume ID? Alternatively, can the volume label be used?

1 Reply

Whether or not you're using Terraform to provision your environments, Volumes must be attached after-the-fact. As you alluded to, in order to attach an existing Volume, you'll need to obtain the Volume ID first via the API/CLI. From our API documentation, the following calls will work to obtain Volume details:

Using the API:

curl -H "Authorization: Bearer $TOKEN" \

Using the CLI:

linode-cli volumes list

Once you have the Volume ID, you'll want to use the provider's Linode Volume resource (linode_volume) to manipulate the Volume itself. Here's an example of how to attach a Volume via Terraform's documentation with the Volume ID (volume_id:

resource "linode_instance" "foo" {
  region             = "us-east"
  type               = "g6-nanode-1"

  config {
    label = "boot-existing-volume"
    kernel = "linode/latest-64bit"
    devices {
      sda {
        volume_id = "123"

Note in the above example that the Volume ID is required, as opposed to the Volume label (i.e. the name of the Volume). It's also worth mentioning per our Block Storage documentation, Volumes can only be attached to one Linode at a time.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct