Sonatype Selected by Equifax to Support OS Governance Press Release

blog-logo Sonatype Blog

Managing Infrastructure at Scale with Terraform

June 10, 2019 By Derek Weeks

Eighty percent of software outages are due to improper changeschanges that occurred at the wrong time or were not properly executed. 

To reduce these outages, you need to address the core problem: human error. The reality is that repetitive tasks, such as infrastructure configurations, should be designed by humans and executed by software. Having machines tackle the repetitive tasks reduces errors and leaves us to do what we do bestsolve problems. This makes our systems more reliable and better designed.

Good news, there is an app for that. Well, a whole open source solution ecosystem, really. Today we are looking at Terraform. Jon Brouse (@jonbrouse) walked through the benefits of Terraform and many code examples in his talk, Terraform at Scale.

Open Source Infrastructure Management

Terraform is an open source infrastructure management project that allows you to safely and predictably create, change, and improve production infrastructure. It is agnostic to the underlying platforms and has over 70 providers. It allows you to write declarative configuration files, treat them as code, and apply version control to them. It is a tool to manage infrastructure as code - a concept that we hear a lot about because it is central to sound DevOps policies.

In fact, Jon reminds us in his talk that as your system grows, so do the risks. It becomes even more important to reduce human errors. Jon’s talk specifically looks at using Terraform at scale with multiple team members, teams, products, and resources.

Use a Style Guide

Jon emphasizes the importance of writing and sticking to a style guide. We aren’t talking style sheets, but rather a guide to dictate a consistent style, such as:

  • Keeping separate files for each resource and group
  • When to use an underscore
  • When to use a hyphen

Terraform has validate and format commands to help you check against your style guide and to properly format code.

Jon also discussed Terraform’s two types of modules: service and infrastructure. Service modules are a reusable library and create all required resources a service needs to be operational. Infrastructure modules are a single repository comprised of multiple root modules. These are where service modules are instantiated and Terraform is run.

For most of his talk, Jon’s walk through code examples in Terraform’s language, HCL (Hashicorp Configuration Language), giving you real examples on how to use Terraform.

null

If you are looking at Terraform as a solution to manage your infrastructure as code, Jon’s talk, below, is well worth 30 minutes of your time. 

Tags: Open Source, Terraform, Post developers/devops, infrastructure as code

Written by Derek Weeks

Derek serves as vice president and DevOps advocate at Sonatype and is the co-founder of All Day DevOps -- an online community of 65,000 IT professionals.