digitalocean_droplets

Get information on Droplets for use in other resources, with the ability to filter and sort the results. If no filters are specified, all Droplets will be returned.

This data source is useful if the Droplets in question are not managed by Terraform or you need to utilize any of the Droplets' data.

Note: You can use the digitalocean_droplet data source to obtain metadata about a single Droplet if you already know the id, unique name, or unique tag to retrieve.

Example Usage

Use the filter block with a key string and values list to filter images.

For example to find all Droplets with size s-1vcpu-1gb:

data "digitalocean_droplets" "small" {
  filter {
    key    = "size"
    values = ["s-1vcpu-1gb"]
  }
}

You can filter on multiple fields and sort the results as well:

data "digitalocean_droplets" "small-with-backups" {
  filter {
    key    = "size"
    values = ["s-1vcpu-1gb"]
  }
  filter {
    key    = "backups"
    values = ["true"]
  }
  sort {
    key       = "created_at"
    direction = "desc"
  }
}

Argument Reference

filter supports the following arguments:

sort supports the following arguments:

Attributes Reference