terraform: digitalocean_{domain/record} type NS

Posted November 24, 2018 4.3k views
DigitalOceanAPIMonitoringDevelopmentInitial Server SetupTerraform

I am working to build my personal and professional infrastructure from the group up using Terraform on DigitalOcean.

The issue I am having is setting up my primary domain name. When created it automatically enters three NS records pointing to ns{1,2,3} which of course makes sense.

However I am trying to achieve vanity nameservers as outlined in this article:

Here is the script attempting to modify ns1

resource "digitalocean_record" "ns" {
    domain = "${}"
    type = "NS"
    name =  ""
    value = "ns1.${}."
    ttl = "1800"

This fails due to the name being empty. Adding a value produces an undesired result.

I would like to either not have these entries entered if possible or edit/modify them.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Hey friend,

Great question! Our API does require the name field. We accept an “@” symbol as simply referring to the root domain.


  • My name is Jason

    Thank you though, I did figure out the @ aspect. However I am still left with the question on how to convert the NS records to that of those mentioned in the previously mentioned article.