Get information on a domain. This data source provides the name, TTL, and zone file as configured on your DigitalOcean account. This is useful if the domain name in question is not managed by Terraform or you need to utilize TTL or zone file data.

An error is triggered if the provided domain name is not managed with your DigitalOcean account.

Example Usage

Get the zone file for a domain:

data "digitalocean_domain" "example" {
  name = ""

output "domain_output" {
  value = data.digitalocean_domain.example.zone_file
  $ terraform apply

data.digitalocean_domain.example: Refreshing state...

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.


domain_output = $ORIGIN
$TTL 1800 IN SOA 1516944700 10800 3600 604800 1800 1800 IN NS 1800 IN NS 1800 IN NS 3600 IN A 3600 IN A 3600 IN A

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the domain.

Attributes Reference

The following attributes are exported:

  • ttl: The TTL of the domain.
  • urn - The uniform resource name of the domain
  • zone_file: The zone file of the domain.