digitalocean_images
Generated on 13 Nov 2025
from Terraform version
v2.69.0
Get information on images for use in other resources (e.g. creating a Droplet based on a snapshot), with the ability to filter and sort the results. If no filters are specified, all images will be returned.
This data source is useful if the image in question is not managed by Terraform or you need to utilize any of the image’s data.
Note: You can use the digitalocean_image data source to obtain metadata
about a single image if you already know the slug, unique name, or id to retrieve.
Example Usage
Use the filter block with a key string and values list to filter images.
For example to find all Ubuntu images:
data "digitalocean_images" "ubuntu" {
filter {
key = "distribution"
values = ["Ubuntu"]
}
}You can filter on multiple fields and sort the results as well:
data "digitalocean_images" "available" {
filter {
key = "distribution"
values = ["Ubuntu"]
}
filter {
key = "regions"
values = ["nyc3"]
}
sort {
key = "created"
direction = "desc"
}
}Argument Reference
-
filter- (Optional) Filter the results. Thefilterblock is documented below. -
sort- (Optional) Sort the results. Thesortblock is documented below.
filter supports the following arguments:
-
key- (Required) Filter the images by this key. This may be one ofdistribution,error_message,id,image,min_disk_size,name,private,regions,size_gigabytes,slug,status,tags, ortype. -
values- (Required) A list of values to match against thekeyfield. Only retrieves images where thekeyfield takes on one or more of the values provided here. -
match_by- (Optional) One ofexact(default),re, orsubstring. For string-typed fields, specifyreto match by using thevaluesas regular expressions, or specifysubstringto match by treating thevaluesas substrings to find within the string field. -
all- (Optional) Set totrueto require that a field match all of thevaluesinstead of just one or more of them. This is useful when matching against multi-valued fields such as lists or sets where you want to ensure that all of thevaluesare present in the list or set.
sort supports the following arguments:
key- (Required) Sort the images by this key. This may be one ofdistribution,error_message,id,image,min_disk_size,name,private,size_gigabytes,slug,status, ortype.direction- (Required) The sort direction. This may be eitherascordesc.
Attributes Reference
images- A set of images satisfying anyfilterandsortcriteria. Each image has the following attributes:slug: Unique text identifier of the image.id: The ID of the image.name: The name of the image.type: Type of the image.distribution- The name of the distribution of the OS of the image.min_disk_size: The minimum ‘disk’ required for the image.size_gigabytes: The size of the image in GB.private- Is image a public image or not. Public images represent Linux distributions or One-Click Applications, while non-public images represent snapshots and backups and are only available within your account.regions: A set of the regions that the image is available in.tags: A set of tags applied to the imagecreated: When the image was createdstatus: Current status of the imageerror_message: Any applicable error message pertaining to the imageimage- The id of the image (legacy parameter).