Infrastructure as Code is the single skill that separates cloud engineers from people who can click through the AWS console. If you can write Terraform, you can automate infrastructure, version control it, review it in pull requests, and reproduce it consistently. This is what companies pay cloud engineers to do.
Based on our analysis of 1,000+ cloud job postings, Terraform appears in 70% of cloud engineer listings. It's the most requested IaC tool by a significant margin. Here's how to learn it.
What Is Terraform?
Terraform is a tool that lets you define cloud infrastructure in code files (written in HCL — HashiCorp Configuration Language). Instead of clicking "Launch Instance" in the AWS console, you write a .tf file describing what you want, and Terraform provisions it.
The core workflow is three commands:
terraform init— Initialize the working directory, download providersterraform plan— Preview what changes will be madeterraform apply— Execute the changes
And to tear everything down: terraform destroy. This is powerful — you can spin up an entire environment for testing and destroy it when you're done, paying only for the time used.
Your First Terraform Configuration
Here's what a simple EC2 instance looks like in Terraform:
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "web_server" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t2.micro"
tags = {
Name = "my-first-terraform-server"
}
}
That's it. Four lines of meaningful code and you have a server. Run terraform apply and it exists in AWS. Run terraform destroy and it's gone. This is the power of IaC.
Key Terraform Concepts
Providers — Plugins that connect Terraform to cloud platforms. The AWS provider, Azure provider, GCP provider, etc. You can even manage GitHub repos, DNS records, and Kubernetes resources with Terraform.
Resources — The infrastructure components you're creating. aws_instance, aws_s3_bucket, aws_vpc, aws_security_group — each maps to a real AWS resource.
Variables — Parameters that make your code reusable. Instead of hardcoding "us-east-1", use a variable so the same code works in any region.
Outputs — Values exported from your configuration. After creating an EC2 instance, output its public IP so you know where to connect.
State — Terraform tracks what it has created in a state file. This is how it knows what to update or destroy. In production, state is stored remotely (in S3) so teams can collaborate.
Modules — Reusable packages of Terraform code. Instead of writing VPC configuration every time, create a module and call it with different parameters.
Building a Real Infrastructure with Terraform
Take the VPC architecture from the networking guide and build it entirely with Terraform:
- VPC with CIDR block
- Public and private subnets across 2 AZs
- Internet Gateway and NAT Gateway
- Route tables with proper associations
- Security groups for web servers and databases
- EC2 instances in public subnets
- RDS instance in private subnets
- Application Load Balancer
This exercise takes everything you've learned so far — Linux, networking, AWS services — and combines it with IaC. It's also an excellent portfolio project that demonstrates real-world cloud engineering skills.
Terraform State Management
By default, Terraform stores state locally in a terraform.tfstate file. This works for learning but breaks in teams. For production:
- Store state in S3 with DynamoDB locking
- Never commit state files to Git (they can contain secrets)
- Use state locking to prevent concurrent modifications
- Enable versioning on your S3 state bucket for rollback capability
Setting up remote state is one of the first things you do in any real Terraform project. It's a common interview question and a critical production practice.
Terraform Best Practices
- Use modules — Don't repeat yourself. Create modules for common patterns (VPC, ECS cluster, Lambda function)
- Use variables — Never hardcode values. Use variables with sensible defaults
- Use workspaces or directory structure — Separate environments (dev, staging, prod)
- Run plan before apply — Always review planned changes. In CI/CD, post the plan output as a PR comment
- Version pin providers — Lock provider versions to prevent unexpected changes
- Tag everything — Apply consistent tags for cost tracking and resource management
These best practices come from real-world experience. Following them in your portfolio projects signals to interviewers that you understand production-grade infrastructure, not just tutorial-level deployments.
Land Your 6-Figure Cloud Engineering Role in 180 Days
Master AWS, DevOps & AI with the First Principles Blueprint. 900+ engineers trained and hired. Guaranteed — or we keep working with you until you are.
Frequently Asked Questions
Why Terraform instead of AWS CloudFormation?
Terraform is cloud-agnostic (works with AWS, Azure, GCP, and hundreds of other providers), has a cleaner syntax (HCL vs JSON/YAML), and is the most in-demand IaC tool. Based on our analysis of 1,000+ cloud job postings, Terraform appears in 70% of listings vs 30% for CloudFormation. Learn Terraform first.
How long does it take to learn Terraform?
You can learn Terraform fundamentals in 2-3 weeks with focused practice. Start by deploying simple resources (EC2, S3), then progress to modules and state management. The key is rebuilding AWS projects you already deployed manually — this reinforces both Terraform and AWS skills simultaneously.
Do I need to learn Terraform for a cloud engineering job?
Yes. Infrastructure as Code is a non-negotiable skill for cloud engineering roles. Terraform is the industry standard, appearing in the majority of cloud job postings. Companies expect cloud engineers to provision, manage, and version control infrastructure through code, not manual console clicks.

Creator of Tech with Soleyman — the #1 YouTube channel for Cloud Engineering, AWS, and Cloud Security education with 166K+ subscribers. 900+ engineers have gone through Cloud Engineer Academy and landed roles at AWS, Google, Microsoft, Deloitte, and more.
Continue Reading
How to Become a Cloud Engineer in 2026: The First Principles Approach
Ci CdCI/CD for Cloud Engineers: GitHub Actions from Zero to Deployment
AwsAWS Core Services You Actually Need to Know as a Cloud Engineer
PortfolioHow to Build a Cloud Engineering Portfolio That Gets You Hired
NetworkingNetworking Essentials for Cloud Engineers: A Practical Guide
Land Your 6-Figure Cloud Engineering Role in 180 Days
Master AWS, DevOps & AI with the First Principles Blueprint. 900+ engineers trained and hired. Guaranteed — or we keep working with you until you are.
900+ engineers trained and hired