Day 55 of 90 Days of DevOps Challenge: Terraform Installation & Architecture Deep Dive


Yesterday, I officially entered the world of Infrastructure as Code (IaC) by exploring Terraform, an open-source tool by HashiCorp that enables DevOps teams to define, provision, and manage infrastructure across multiple cloud providers using simple declarative code.
I understood why IaC is crucial in today’s fast-paced cloud-native world and how Terraform stands out with features like multi-cloud support, reusable modules, and version-controlled infrastructure.
To move from theory to practice, I focused on installing Terraform on a Windows system, setting up the development environment with Visual Studio Code (VS Code), exploring Terraform architecture and its core workflow, and understanding key Terraform commands used to provision, manage, and destroy infrastructure
Terraform Installation on Windows
To start writing and testing Terraform configurations locally, I followed a structured setup process:
Step 1: Download and Extract Terraform
I downloaded the latest stable Windows build of Terraform from the official Terraform website.
After downloading the
.zip
file, I extracted it to a preferred location (e.g.,C:\Terraform
).The folder contains a single binary:
terraform.exe
This is the CLI we’ll use throughout.
Step 2: Set Environment Variables
To make Terraform accessible from any command prompt:
I added the Terraform folder path (
C:\Terraform
) to the System Environment Variables under thePath
variable.This allows me to run Terraform from any directory without navigating to the installation folder.
Step 3: Verify the Installation
I launched the Command Prompt and verified the installation using:
terraform -v
The terminal output confirmed the installation and displayed the Terraform version.
Step 4: Install VS Code
To write and manage Terraform configuration files efficiently, I installed Visual Studio Code:
Download Visual Studio Code - Mac, Linux, Windows
Additionally, I installed the Terraform extension by HashiCorp from the VS Code marketplace, which provides:
Syntax highlighting
IntelliSense
Format and validation support
Quick error detection
Understanding Terraform Architecture
At its core, Terraform uses a declarative configuration language called HCL (HashiCorp Configuration Language) to define infrastructure resources like compute instances, networks, and databases in .tf
files.
A basic Terraform workflow includes:
Write → Initialize → Format → Validate → Plan → Apply → Destroy
Let’s break that down:
1. Write Configuration (.tf file)
Create your infrastructure definitions using HCL and save them with a .tf
extension. For example:
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "example" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
}
2. terraform init
Initializes the working directory and downloads required provider plugins.
terraform init
3. terraform fmt
Formats the .tf
files to ensure standard code indentation and readability.
terraform fmt
(Optional but highly recommended)
4. terraform validate
Checks if the configuration syntax is correct.
terraform validate
(Also optional, but helps avoid runtime errors)
5. terraform plan
Creates an execution plan and shows what Terraform will do (add, change, destroy).
terraform plan
This gives you full visibility before anything is provisioned.
6. terraform apply
Applies the planned changes and provisions actual infrastructure.
terraform apply
A terraform.tfstate
file is created to track the current state of infrastructure—this file is critical for managing future updates.
7. terraform destroy
Tear down everything that was created using the .tf
file.
terraform destroy
This helps avoid orphaned resources and unnecessary billing in cloud environments.
Final Thoughts
Today’s session was all about laying the groundwork, literally. By installing Terraform and understanding its architecture and workflow, I’m now ready to start writing real infrastructure configurations and managing infrastructure like application code.
What I love about Terraform is its simplicity paired with power. Whether you’re deploying a single EC2 instance or orchestrating multi-tier cloud-native applications across providers, Terraform has your back.
In the coming days, I’ll start with basic AWS provisioning, starting with launching an EC2 instance using Terraform and then progressively building more advanced and modular infrastructure.
Subscribe to my newsletter
Read articles from Vaishnavi D directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
