digitalocean_tags
Generated on 22 Apr 2025
from Terraform version
v2.51.0
Returns a list of tags in your DigitalOcean account, with the ability to filter and sort the results. If no filters are specified, all tags will be returned.
Example Usage
data "digitalocean_tags" "list" {
sort {
key = "total_resource_count"
direction = "asc"
}
}
output "sorted_tags" {
value = data.digitalocean_tags.list.tags
}
Argument Reference
The following arguments are supported:
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 tags by this key. This may be one ofname
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
. -
values
- (Required) Only retrieves tags which keys has value that matches one 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 tags by this key. This may be one ofname
,total_resource_count
,droplets_count
,images_count
,volumes_count
,volume_snapshots_count
, ordatabases_count
.direction
- (Required) The sort direction. This may be eitherasc
ordesc
.
Attributes Reference
The following attributes are exported for each tag:
name
- The name of the tag.total_resource_count
- A count of the total number of resources that the tag is applied to.droplets_count
- A count of the Droplets the tag is applied to.images_count
- A count of the images that the tag is applied to.volumes_count
- A count of the volumes that the tag is applied to.volume_snapshots_count
- A count of the volume snapshots that the tag is applied to.databases_count
- A count of the database clusters that the tag is applied to.