Update: I took this blog post series, expanded it, and turned it into a book called Terraform: Up & Running!
In Part 1 of the Comprehensive Guide to Terraform series, we explained why we picked Terraform as our IAC tool of choice and not Chef, Puppet, Ansible, SaltStack, or CloudFormation. In Part 2 of the series, we introduced the basics of Terraform in a step-by-step tutorial that showed how to deploy a cluster of web servers and a load balancer on AWS. In Part 3, we discussed how to manage Terraform state, file layout, isolation, and locking. In this post, we discuss how to create reusable infrastructure with terraform modules:
Terraform modules allow you to package a piece of infrastructure (e.g. a Docker cluster or a distributed cache) in a way that makes it easy reuse it in multiple places in your code base.