This repository demonstrates how to use Terraform to provision AWS infrastructure step-by-step — starting from basic S3 bucket creation to fully modular multi‑environment AWS deployments with Terraform state management using S3 & DynamoDB.
The project is organized by learning days:
| Day | Topic | Concepts Learned |
|---|---|---|
| ✅ Day‑1 | Local File + S3 | Basic Terraform resources & providers |
| ✅ Day‑2 | VPC + EC2 | Networking, EC2, Key Pair, Public subnet |
| ✅ Day‑3 | Remote State (S3 + DynamoDB) | Terraform state locking & backend config |
| ✅ Day‑4 | Terraform Modules + Multi‑Environment | Re‑usable modules, staging/prod infra |
- Project Overview
- Folder Structure
- Tools and Requirements
- Day‑1 — Local + S3
- Day‑2 — VPC + EC2
- Day‑3 — Terraform State Backend
- Day‑4 — Terraform Modules + Environments
- Commands Reference
- Cleanup
- Learning Outcomes
- Author
This Terraform project automates deployment from Beginner level to Advance Practical Terraform Workflows:
- ✅ Local File & S3 bucket
- ✅ Custom VPC, Subnet, EC2, Key‑pair
- ✅ Terraform Backend using S3 + DynamoDB
- ✅ Terraform VPC module
- ✅ Multi‑environment Infra (Dev, Staging, Prod)
- ✅ Reusable Module for Infra deployment
terraform-beginner-to-intermediate-advanced/
│
├── Day-1/
│ ├── main.tf
│ ├── provider.tf
│ ├── s3.tf
│ ├── terraform.tf
│
├── Day-2/
│ ├── ec2.tf
│ ├── providers.tf
│ ├── terraform.tf
│
├── Day-3/
│ ├── dynamodb.tf
│ ├── s3.tf
│ ├── provider.tf
│ ├── terraform.tf
│
├── Day-4/
│ ├── variables.tf
│ ├── vpc.tf
│ ├── terraform.tf
│ ├── provider.tf
│ │
│ └── terraform-modules-app/
│ ├── main.tf
│ ├── terraform.tf
│ ├── provider.tf
│ │
│ └── infra-app/
│ ├── ec2.tf
│ ├── s3.tf
│ ├── dynamodb.tf
│ ├── variables.tf
│
└── README.md
- ✅ AWS Account
- ✅ AWS CLI Installed & Configured (
aws configure) - ✅ Terraform Installed
- ✅ SSH Key for EC2 (
terra-key-ec2.pub)
Commands:
cd Day-1
terraform init
terraform plan
terraform apply -auto-approveCreates:
| Resource | Description |
|---|---|
local_file |
Creates a local file |
aws_s3_bucket |
Creates S3 bucket |
Commands:
cd Day-2
terraform init
terraform apply -auto-approveCreates:
- Custom VPC
- Public subnet
- IGW + Route Table
- Security Group
- Key‑pair
- EC2 instance
SSH:
ssh -i "terra-key-ec2" ubuntu@<EC2_PUBLIC_IP>Day‑3 introduces:
| Component | Purpose |
|---|---|
| S3 Bucket | Stores Terraform state |
| DynamoDB | State locking (prevents corruption) |
Commands:
cd Day-3
terraform init
terraform apply -auto-approveCreates:
- VPC
- Public + Private Subnets
- NAT + VPN
Environments:
devstagingprod
Each env creates:
- EC2 Instances
- S3 Bucket
- DynamoDB Table
- Key Pair
- Security Group
Run:
cd Day-4/terraform-modules-app
terraform init
terraform apply -auto-approve| Command | Description |
|---|---|
terraform init |
Initialize |
terraform plan |
Preview changes |
terraform apply |
Apply infra |
terraform destroy |
Delete infra |
terraform state list |
List state objects |
terraform destroy -auto-approveRun destroy inside each day's folder separately
You learned how to:
✅ Install & configure AWS CLI
✅ Use Terraform providers & resources
✅ Deploy VPC, EC2, S3, IAM, Subnets, SG
✅ Configure remote state & locking
✅ Work with Terraform modules
✅ Build multi‑environment infra
🚀 You have completed an end‑to‑end real‑world Terraform project
Muhammad Uzair Saeedi
Terraform | AWS | IaC Automation
Region: us-east-1
“Automate Everything with Terraform — Simplify Your Cloud Journey” 🌍