Infrastructure-as-Code Series: DNS (Part 2)

Friday, May 17, 2019 13:40 · 254 words · 2 minutes read terraform devops iac series

Infrastructure-as-Code Series

  1. Getting Started
  2. Project Structure
  3. DNS (Part 1)
  4. DNS (Part 2)

In my previous blog post “Infrastructure-as-Code Series: DNS (Part 1)” I have described how to setup a PowerDNS Administrative server.

I will use the setup from the previous blog post to prepare a DigitalOcean Images Snapshot for the DNS server provisioning.

DigitalOcean Snapshots

Snapshots provide a full copy of a DigitalOcean Droplet or volume.

Create a snapshot

  • Go to Manage / Images and choose the Snapshots tab
  • Choose your PowerDNS droplet and enter image name
  • Take the snapshot

Once the snapshot is ready, it will be added within the Snapshots table. Click on the More button for the newly created image snapshot and choose the option Add to Region, to make it available in your availability DigitalOcean region.

Using the DigitalOcean REST API fetch the snapshot id.

Terraform for DNS

Configuration

Note: Setup is tested against PowerDNS Administrative Server 4.1.1

Under the dns folder in the Digital Ocean Infrastructure as Code project you could find the Terraform infrastructure code files for the DNS configurations.

Now you need to enter the corresponding configuration variables values under the dc/<region>/<environment>/terraform.tfvars file.

Deployment

make deploy dc=fra1 env=staging op=dns
...
Apply complete! Resources: 4 added, 0 changed, 0 destroyed.

Outputs:

set_dns_private_ip = export TF_VAR_dns_private_ip=<dns_private_ip>
set_dns_public_ip = export TF_VAR_dns_public_ip=<dns_public_ip>

In the next blog post I will describe how to provision compute nodes and configure them to use the PowerDNS server deployment from this blog post.

The complete demo application, described in this blog post, can be found here.
comments powered by Disqus