digitalocean_projects
Generated on 10 Jun 2025
from Terraform version
v2.56.0
Retrieve information about all DigitalOcean projects associated with an account, with the ability to filter and sort the results. If no filters are specified, all projects will be returned.
Note: You can use the digitalocean_project
data source to
obtain metadata about a single project if you already know the id
to retrieve or the unique
name
of the project.
Example Usage
Use the filter
block with a key
string and values
list to filter projects.
For example to find all staging environment projects:
data "digitalocean_projects" "staging" {
filter {
key = "environment"
values = ["Staging"]
}
}
You can filter on multiple fields and sort the results as well:
data "digitalocean_projects" "non-default-production" {
filter {
key = "environment"
values = ["Production"]
}
filter {
key = "is_default"
values = ["false"]
}
sort {
key = "name"
direction = "asc"
}
}
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 projects by this key. This may be one ofname
,purpose
,description
,environment
, oris_default
. -
values
- (Required) A list of values to match against thekey
field. Only retrieves projects 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 projects by this key. This may be one ofname
,purpose
,description
, orenvironment
.direction
- (Required) The sort direction. This may be eitherasc
ordesc
.
Attributes Reference
projects
- A set of projects satisfying anyfilter
andsort
criteria. Each project has the following attributes:id
- The ID of the projectname
- The name of the projectdescription
- The description of the projectpurpose
- The purpose of the project (Default: “Web Application”)environment
- The environment of the project’s resources. The possible values are:Development
,Staging
,Production
.resources
- A set of uniform resource names (URNs) for the resources associated with the projectowner_uuid
- The unique universal identifier of the project ownerowner_id
- The ID of the project ownercreated_at
- The date and time when the project was created, (ISO8601)updated_at
- The date and time when the project was last updated, (ISO8601)