Skip to content

uzairsaeedi/Terraform--Beginner-to-Intermediate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☁️ Terraform Beginner to Intermediate to Advance Project — By Muhammad Uzair Saeedi

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

🧭 Table of Contents

  1. Project Overview
  2. Folder Structure
  3. Tools and Requirements
  4. Day‑1 — Local + S3
  5. Day‑2 — VPC + EC2
  6. Day‑3 — Terraform State Backend
  7. Day‑4 — Terraform Modules + Environments
  8. Commands Reference
  9. Cleanup
  10. Learning Outcomes
  11. Author

🌍 Project Overview

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

📁 Folder Structure

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

🛠️ Tools and Requirements

  • ✅ AWS Account
  • ✅ AWS CLI Installed & Configured (aws configure)
  • ✅ Terraform Installed
  • ✅ SSH Key for EC2 (terra-key-ec2.pub)

☁️ Day‑1 — Local + S3 Setup

Commands:

cd Day-1
terraform init
terraform plan
terraform apply -auto-approve

Creates:

Resource Description
local_file Creates a local file
aws_s3_bucket Creates S3 bucket

🌐 Day‑2 — VPC, Security Group and EC2

Commands:

cd Day-2
terraform init
terraform apply -auto-approve

Creates:

  • 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 — Remote Terraform State Management

Day‑3 introduces:

Component Purpose
S3 Bucket Stores Terraform state
DynamoDB State locking (prevents corruption)

Commands:

cd Day-3
terraform init
terraform apply -auto-approve

🏗️ Day‑4 — Terraform Modules + Multi‑Environment Infra

✅ Uses Terraform Registry VPC Module

Creates:

  • VPC
  • Public + Private Subnets
  • NAT + VPN

✅ Multi‑Environment Structure

Environments:

  • dev
  • staging
  • prod

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

🧱 Terraform Commands Reference

Command Description
terraform init Initialize
terraform plan Preview changes
terraform apply Apply infra
terraform destroy Delete infra
terraform state list List state objects

🧹 Cleanup Instructions

terraform destroy -auto-approve

Run destroy inside each day's folder separately


🏷️ Learning Outcomes

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


👨‍💻 Author

Muhammad Uzair Saeedi
Terraform | AWS | IaC Automation
Region: us-east-1

“Automate Everything with Terraform — Simplify Your Cloud Journey” 🌍

About

A complete Terraform + AWS Infrastructure Automation project — from basic S3 creation to advanced, modular multi-environment (Dev | Staging | Prod) deployments. Includes VPC, EC2, S3, and DynamoDB remote state management, reusable Terraform modules, and full IaC workflows.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors