digitalocean_volume

Get information on a volume for use in other resources. This data source provides all of the volumes properties as configured on your DigitalOcean account. This is useful if the volume in question is not managed by Terraform or you need to utilize any of the volumes data.

An error is triggered if the provided volume name does not exist.

Example Usage

Get the volume:

data "digitalocean_volume" "example" {
  name   = "app-data"
  region = "nyc3"
}

Reuse the data about a volume to attach it to a Droplet:

data "digitalocean_volume" "example" {
  name   = "app-data"
  region = "nyc3"
}

resource "digitalocean_droplet" "example" {
  name   = "foo"
  size   = "s-1vcpu-1gb"
  image  = "ubuntu-18-04-x64"
  region = "nyc3"
}

resource "digitalocean_volume_attachment" "foobar" {
  droplet_id = digitalocean_droplet.example.id
  volume_id  = data.digitalocean_volume.example.id
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported: