Terraforming your Infrastructure

Terraform is a tool that enables you to easily orchestrate potentially complex infrastructure. The simplicity of the tool also allows you to code yourself into a corner. This talk aims to offer practical techniques to avoid common hurdles that often result in a refactor.

Cloud Computing is a broad term that describes a diverse and rapidly expanding set of on-demand services. The availability of these services does not mean they are simple to use or easily integrated with each other or with your infrastructure. Terraform provides a common interface for these services and allows for the expression of your infrastructure as code. Terraforming Your Infrastructure will get you started with Terraform and help you avoid common hurdles that are encountered as your configurations get more advanced. We will…

learn how Terraform simplifies infrastructure management.
demonstrate practical techniques to avoid common problems.
deploy single and multi-provider configurations using Terraform.

6.
November 15, 2016
We needed
A tool that wasn’t specific to AWS
Something that was easier to read and understand
To fully understand what was going to change upon execution
The ability to collaborate more easily on our infrastructure

8.
November 15, 2016
What is Terraform
“…is a tool for building, changing, and versioning infrastructure safely and efficiently.”
Uses configuration files to describe the desired infrastructure.
Has providers which are the interface between Terraform and cloud services
Has provisioners which it can execute to initialize a resource in some way
Can be packaged by creating modules… DRY IaC?

9.
November 15, 2016
What Terraform isn’t
A programming language
A preclusion for understanding best practices of your providers
Going to save you from doing something dumb

21.
November 15, 2016
Protect your State
The statefile is the *actual* state of your infrastructure! It must be protected!
Direct editing of this file, while possible, is generally a bad idea.
If you are going to tinker with your statefiles make sure you have a copy saved somewhere!

22.
November 15, 2016
Remote State
Check your configurations into Git, not your statefiles.
Remote state allows for easier collaboration between teams
It provides ways to expose information between environments using outputs
Additionally, where possible enable versioning and encryption… S3

23.
November 15, 2016
Use Terragrunt
Terragrunt is a thin wrapper for Terraform created by Gruntwork (gruntwork.io)
It enforces best practices for Terraform state
It supports locking using Amazon’s DynamoDB as the locking mechanism
If your Golang is on point, contribute to the project!
https://github.com/gruntwork-io/terragrunt

30.
November 15, 2016
Use Modules
Modules are a way to “package” Terraform configurations
Modules are just an isolated Terraform configuration
Module take inputs as variables and provide outputs as attributes
Gitignore your .terraform directory