digitalocean_spaces_buckets
Generated on 13 Nov 2025
from Terraform version
v2.69.0
Get information on Spaces buckets for use in other resources, with the ability to filter and sort the results. If no filters are specified, all Spaces buckets will be returned.
Note: You can use the digitalocean_spaces_bucket data source to
obtain metadata about a single bucket if you already know its name and region.
Example Usage
Use the filter block with a key string and values list to filter buckets.
Get all buckets in a region:
data "digitalocean_spaces_buckets" "nyc3" {
filter {
key = "region"
values = ["nyc3"]
}
}You can sort the results as well:
data "digitalocean_spaces_buckets" "nyc3" {
filter {
key = "region"
values = ["nyc3"]
}
sort {
key = "name"
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 ofbucket_domain_name,name,region, orurn. -
values- (Required) A list of values to match against thekeyfield. Only retrieves Spaces buckets 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 ofbucket_domain_name,name,region, orurn.direction- (Required) The sort direction. This may be eitherascordesc.
Attributes Reference
-
buckets- A list of Spaces buckets satisfying anyfilterandsortcriteria. Each bucket has the following attributes:name- The name of the Spaces bucketregion- The slug of the region where the bucket is stored.urn- The uniform resource name of the bucketbucket_domain_name- The FQDN of the bucket (e.g. bucket-name.nyc3.digitaloceanspaces.com)endpoint- The FQDN of the bucket without the bucket name (e.g. nyc3.digitaloceanspaces.com)