digitalocean_record

Provides a DigitalOcean DNS record resource.

Example Usage

resource "digitalocean_domain" "default" {
  name = "example.com"
}

# Add an A record to the domain for www.example.com.
resource "digitalocean_record" "www" {
  domain = digitalocean_domain.default.id
  type   = "A"
  name   = "www"
  value  = "192.168.0.11"
}

# Add a MX record for the example.com domain itself.
resource "digitalocean_record" "mx" {
  domain   = digitalocean_domain.default.id
  type     = "MX"
  name     = "@"
  priority = 10
  value    = "mail.example.com."
}

# Output the FQDN for the www A record.
output "www_fqdn" {
  value = digitalocean_record.www.fqdn # => www.example.com
}

# Output the FQDN for the MX record.
output "mx_fqdn" {
  value = digitalocean_record.mx.fqdn # => example.com
}

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

Records can be imported using the domain name and record id when joined with a comma. See the following example:

terraform import digitalocean_record.example_record example.com,12345678