Introduction

Welcome to the Terraform Playbook for Infrastructure as Code. This playbook is split into 2 parts, covering the following:

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/36ec8667-f627-48bc-a1db-7b8105b3e787/Terraform_CICD_Pipeline_-_Page_2.png

In this playbook, we'll cover the standards to be followed while setting up your Terraform environment, writing Terraform code, managing costs & security with Terraform, and deploying and managing infrastructure with Terraform. We'll also introduce best practices for organizing your Terraform code, using Terraform modules to manage complex infrastructure, and using Terraform Lint to ensure code quality.

Setting Up Terraform Environment

To Download and install Terraform, please follow the official guide - link

General Terraform Best Practices:

This folder structure provides a clear separation of concerns and allows for easy management of Terraform projects and their dependencies.

Module Creation

Here at CAW Studios, we use a combination of community and custom modules to help speed up the development and provide accessibility to the developers. Creating Terraform modules involves defining reusable infrastructure components that can be easily reused across different Terraform projects. Modules allow for the creation of self-contained pieces of infrastructure code that can be easily tested, maintained, and versioned. We have developed a host of custom modules, including a module for VPC, RDS, ALB, etc.

In the case of community modules being used, these are never fetched from the registry, a custom version compatible with the infrastructure is made available offline as part of the project, and any changes needed for the module are made and pushed as part of the same project so that any version updates do not break existing functionality.