Overviewing Terraform best practices
Before starting to learn how to install Terraform through the recipes presented in this chapter, it’s necessary to understand the most common best practices of IaC with Terraform.
The first group of best practices is about IaC and are best practices for development in general:
- Store all Terraform configuration files and source code using a version control system such as GitHub, Azure DevOps, or Bitbucket.
- When the code is in Git, apply all good Git practices using branches, tags, commits, comments, and pull requests.
- Decouple your code file with multiple components; having a big monolithic code structure will make maintenance and deployment more difficult.
- Modularize and share common code for better reusability. For example, do not repeat the same code (as per the Don’t Repeat Yourself (DRY) principle) and share the same business logic between components. We will learn about Terraform module implementation...