digitalocean_spaces_buckets
Generated on 17 Apr 2025
from Terraform version
v2.51.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. Thefilter
block is documented below. -
sort
- (Optional) Sort the results. Thesort
block 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 thekey
field. Only retrieves Spaces buckets where thekey
field takes on one or more of the values provided here. -
match_by
- (Optional) One ofexact
(default),re
, orsubstring
. For string-typed fields, specifyre
to match by using thevalues
as regular expressions, or specifysubstring
to match by treating thevalues
as substrings to find within the string field. -
all
- (Optional) Set totrue
to require that a field match all of thevalues
instead 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 thevalues
are 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 eitherasc
ordesc
.
Attributes Reference
-
buckets
- A list of Spaces buckets satisfying anyfilter
andsort
criteria. 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)