domain_record

Generated on 3 Jul 2025 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_options
dict
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.
data
str / 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_name
str / required
The domain name.
flags
int
An unsigned integer between 0-255 used for CAA records.
module_override_options
dict
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.
name
str / required
The host name, alias, or service being defined by the record.
port
int
The port for SRV records.
priority
int
The priority for SRV and MX records.
state
str
Choices:
  • present (default)
  • absent
State of the resource, present to create, absent to destroy.
tag
str
Choices:
  • issue
  • issuewild
  • iodef
The parameter tag for CAA records.
timeout
int
Default: 300 Polling timeout in seconds.
token
str
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
ttl
int
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.
type
str / required
Choices:
  • A
  • AAAA
  • CAA
  • CNAME
  • MX
  • NS
  • SOA
  • SRV
  • TXT
The type of the DNS record.
weight
int
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.50

Return Values

KeyReturnedDescription
domain_record
dict
always Domain record.
Sample:
{
  "domain_record": {
    "data": "192.168.100.50",
    "flags": null,
    "id": 28448433,
    "name": "www.example.com",
    "port": null,
    "priority": null,
    "tag": null,
    "ttl": 1800,
    "type": "A",
    "weight": null
  }
}
error
dict
failure DigitalOcean API error.
Sample:
{
  "Message": "Informational error message.",
  "Reason": "Unauthorized",
  "Status Code": 401
}
msg
str
always Domain record result information.
Sample:
[
  "Created domain record www A in example.com",
  "Deleted domain record www A in example.com",
  "Domain record www A exists in example.com",
  "Domain record www A would be created in example.com",
  "Domain record www A would be deleted from example.com",
  "Domain record www A does not exist in example.com"
]

We can't find any results for your search.

Try using different keywords or simplifying your search terms.