Infrastructure as Code with Terraform

Geographically Diverse Failover in the Cloud

Fail2plan = Plan2fail

When I hit the Go button (or at least the dry-run Plan button) with the command,

$ terraform plan

I am offered the output shown in Figure 2. Note the “+” signs on the left-hand side, which implies that the mighty Terraform is creating and not deleting the resources shown. Clearly this is especially important when you’re working in critical environments. You can see the creation of a single A record, three MX records, and a DNS zone called chris_DNS_zone .

Figure 2: The results of the terraform plan command.

Terraforming

Now I will hit Go for real. (By “Go,” I do of course mean running the terraform apply command.) Terraform sensibly asks me to type the word yes to confirm that the three plus signs shown are actually what I want. After typing yes , I then wait patiently for a little while before receiving the abbreviated output shown in Figure 3.

Figure 3: The abbreviated output after applying the code in Listing 2 to the Amazon Route53 service.

If you look a little closer at Figure 3, you can see I was offered a countdown timer of sorts. At the bottom of the output, the Apply complete! message offers the good news that I added three resources but didn’t delete or change any other existing resources.

Gooey

A quick look in the GUI (the AWS web console) shows that I did indeed affect the configuration of AWS (Figure 4). In five minutes (look for 300 seconds as opposed to 5 minutes), the TTLs were created, and AWS or Terraform in its wisdom created the DNS zone using default values of 172,800 seconds for the name server (NS) TTLs and 900 seconds for the SOA (Start of Authority record within the zone).

Figure 4: Terraform appears to have worked as intended.

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs



Support Our Work

ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.

Learn More”>
	</a>

<hr>		    
			</div>
		    		</div>

		<div class=