1 A brief overview of Terraform
This chapter covers
- Introducing Infrastructure as Code
- Basic Terraform Components
- Declarative languages and graphs
- The Terraform Deployment Workflow
- The Relationship between Terraform and OpenTofu
The first time I set up an AWS Virtual Private Cloud (VPC, the abstraction AWS uses to isolate networks), it was done by hand and it took me several days. Even after I gained experience with the system it still took several hours to manually create and configure a VPC that followed the suggested best practices.
When I first discovered Terraform I attempted to build a VPC again. Terraform was the first Infrastructure as Code tool I had used: Terraform promised to let me define infrastructure, such as VPCs, using a simple programming language and then let Terraform handle creating the infrastructure itself. Instead of creating it manually, I wrote code using the Terraform language to describe my VPC and all of the components that it needed.
When I first ran the code I was blown away. Terraform launched over 70 resources needed to create that highly available VPC Structure and it did it in about a minute. From then on whenever I needed a VPC it was a simple matter of reusing that code. A task that previously took hours was now an afterthought. Just as importantly, that task was suddenly easy.