domain_record
Generated on 13 Feb 2026
from digitalocean.cloud version
v1.2.1
Synopsis
Domain record resources are used to set or retrieve information about the individual DNS records configured for a domain. This allows you to build and manage DNS zone files by adding and modifying individual records for a domain. View the API documentation at https://docs.digitalocean.com/reference/api/api-reference/#tag/Domain-Records.
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. | |
datastr / required |
Variable data depending on record type. For example, the “data” value for an A record would be the IPv4 address to which the domain will be mapped. For a CAA record, it would contain the domain name of the CA being granted permission to issue certificates. | |
domain_namestr / required |
The domain name. | |
flagsint |
An unsigned integer between 0-255 used for CAA records. | |
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. | |
namestr / required |
The host name, alias, or service being defined by the record. | |
portint |
The port for SRV records. | |
priorityint |
The priority for SRV and MX records. | |
statestr |
Choices:
|
State of the resource, present to create, absent to destroy. |
tagstr |
Choices:
|
The parameter tag for CAA records. |
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 |
|
ttlint |
This value is the time to live for the record, in seconds. This defines the time frame that clients can cache queried information before a refresh kshould be requested. | |
typestr / required |
Choices:
|
The type of the DNS record. |
weightint |
The weight for SRV records. |
Examples
- name: Create domain A record
digitalocean.cloud.domain_record:
token: "{{ token }}"
domain_name: example.com
type: A
name: www
data: 192.168.100.50Return Values
| Key | Returned | Description |
|---|---|---|
domain_recorddict |
always | Domain record. Sample: |
errordict |
failure | DigitalOcean API error. Sample: |
msgstr |
always | Domain record result information. Sample: |