Setting up route53 with terraform

760 views
Skip to first unread message

Felipe Sere

unread,
Oct 4, 2015, 9:23:15 AM10/4/15
to Terraform
Hi everyone,

I was wondering how one would go about setting up the nameservers for a registered domain in Route53 with Terraform?
What I have done so far is add a hosted zone and a bunch of records, but then I have to go in manually punch in the servers from the NS
record into the "Name servers" field of the registered domain...

Am I going at this backwards? Should I have to noted the values from the registered domain and then created the NS record with Terraform?

Thanks for you help,

Cheers,
Felipe

James Nugent

unread,
Oct 4, 2015, 9:30:06 PM10/4/15
to Terraform
Hi Felipe,

If your domain name is registered with a third party, you'll need to set the NS records with that provider to point to Route 53. Terraform does not currently do this for any third party as far as I can see from the documentation (I'd imagine most providers do not expose an API publicly for this). That should be a one time operation however. You'll likely need to refer to your domain registrar documentation on the process for changing the name servers. Amazon has some guidance here: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html. You could also transfer your domain to such that Route 53 acts as the registrar. More information on that is here: http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/domain-transfer.html.

Once you have the name servers pointing to Route 53, you can manage the hosted zone and records for the domain name using Terraform with the aws_route53_zone, aws_route53_record and other Route 53 resources in the AWS provider. In fact, it's probably better to set the zone etc up *before* repointing the NS records such that as the change propagates DNS queries are still successful.

Does this make things clearer for you?

Regards,


James

Felipe Sere

unread,
Oct 5, 2015, 5:30:10 AM10/5/15
to Terraform
Hi James,

Thanks for your input.

I bought the domain directly on Amazon, so it shows up in Route53 under "Registered domains".
I am not sure if there is an API to update the nameservers that my domain is on. Keep in mind, these are two steps in Amazon:
1) Ensure the nameservers accept queries about your domain 2) Expose SOA and NS records in the hosted zone.

Step 2 is doable with Terraform, step one isn't yet.
Reply all
Reply to author
Forward
0 new messages