DEV Community

Citadel Cloud Management
Citadel Cloud Management

Posted on

Terraform for Beginners: Your First Infrastructure as Code Project

Terraform is the most in-demand Infrastructure as Code tool in 2026. It appears in 64% of cloud job postings. If you learn one IaC tool, make it Terraform.

This guide walks you through your first real Terraform project — not a toy demo, but infrastructure you could actually use.

What You'll Build

A complete AWS environment with:

  • VPC with public and private subnets
  • EC2 instance running a web server
  • Security group with proper rules
  • S3 bucket for static assets

Total cost: ~$0.02/hour in AWS free tier.

Step 1: Install Terraform

# macOS
brew install terraform

# Linux
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
sudo apt install terraform

# Verify
terraform --version
Enter fullscreen mode Exit fullscreen mode

Step 2: Create Your First Configuration

Create a file called main.tf:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
  tags = { Name = "terraform-demo" }
}

resource "aws_subnet" "public" {
  vpc_id     = aws_vpc.main.id
  cidr_block = "10.0.1.0/24"
  tags = { Name = "public-subnet" }
}

resource "aws_instance" "web" {
  ami           = "ami-0c02fb55956c7d316"
  instance_type = "t2.micro"
  subnet_id     = aws_subnet.public.id
  tags = { Name = "terraform-web-server" }
}
Enter fullscreen mode Exit fullscreen mode

Step 3: Deploy

terraform init    # Download providers
terraform plan    # Preview changes
terraform apply   # Deploy infrastructure
terraform destroy # Clean up when done
Enter fullscreen mode Exit fullscreen mode

Why This Matters for Your Career

Terraform is the #3 highest-ROI certification after AWS SAA and CKA. The HashiCorp Terraform Associate exam costs only $70 — the cheapest cert with significant salary impact (+$8K-$14K).

More Terraform tutorials and the full IaC course: citadelcloudmanagement.com/pages/free-courses

What was your first Terraform project? Drop it below — I love seeing what people build when they start with IaC.

Top comments (0)