project_resources
Generated on 15 Jan 2026
from digitalocean.cloud version
v1.2.1
Synopsis
Assign resources to a DigitalOcean project. Resources can be assigned using their URN (Uniform Resource Name) in the format
do:resource_type:resource_id, for example do:droplet:13457723.
View the API documentation at https://docs.digitalocean.com/reference/api/api-reference/#operation/projects_assign_resources.
Requirements
- pydo >= 0.1.3
- azure-core >= 1.26.1
Parameters
| Parameter | Choices / Default | Description |
|---|---|---|
client_override_optionsdict |
Client override options (developer use). For example, can be used to override the DigitalOcean API endpoint for an internal test suite. If provided, these options will knock out existing options. | |
module_override_optionsdict |
Module override options (developer use). Can be used to override module options to support experimental or future options. If provided, these options will knock out existing options. | |
project_idstr |
A unique identifier for the project. Either project_id or project_name must be specified. If both are specified, project_id takes precedence. |
|
project_namestr |
The name of the project. Either project_id or project_name must be specified. If both are specified, project_id takes precedence. |
|
resourceslist / elements=str |
A list of resource URNs to assign to the project. Each URN should be in the format do:resource_type:resource_id, for example do:droplet:13457723, do:volume:6fc4c277-ea5c-448a-93cd-dd496cfef71f, do:floatingip:192.0.2.1, do:domain:example.com, do:loadbalancer:4de7ac8b-495b-4884-9a69-1050c6793cd6. Resource types supported include droplets, volumes, floating IPs, domains, and load balancers. Required when state=present. |
|
statestr |
Choices:
|
State of the resource, present to create, absent to destroy. |
timeoutint |
Default: 300 |
Polling timeout in seconds. |
tokenstr |
DigitalOcean API token. There are several environment variables which can be used to provide this value. DIGITALOCEAN_ACCESS_TOKEN, DIGITALOCEAN_TOKEN, DO_API_TOKEN, DO_API_KEY, DO_OAUTH_TOKEN and OAUTH_TOKEN |
Examples
- name: Assign resources to a project by project ID
digitalocean.cloud.project_resources:
token: "{{ token }}"
state: present
project_id: "4e1bfbc3-dc3e-41f2-a18f-1b4d7ba71679"
resources:
- "do:droplet:13457723"
- "do:volume:6fc4c277-ea5c-448a-93cd-dd496cfef71f"
- "do:floatingip:192.0.2.1"
- name: Assign resources to a project by project name
digitalocean.cloud.project_resources:
token: "{{ token }}"
state: present
project_name: "my-web-api"
resources:
- "do:droplet:13457723"
- "do:domain:example.com"
- name: Assign a Droplet to the default project
digitalocean.cloud.project_resources:
token: "{{ token }}"
state: present
project_name: "default"
resources:
- "do:droplet:13457723"Return Values
| Key | Returned | Description |
|---|---|---|
errordict |
failure | DigitalOcean API error. Sample: |
msgstr |
always | Project resources result information. Sample: |
projectdict |
always | Project information. Sample: |
resourceslist |
always | Resources assigned to the project. Sample: |