📘 Terraform Series – Day 4

Terraform Workflow: init, validate, plan, apply & destroy
🧠 Before Starting (AWS Setup)
Before using Terraform with AWS, we first need to configure AWS access on our local machine.
👉 Steps:
- Install AWS CLI
- Configure AWS using:
aws configure
👉 It will ask for:
AWS Access Key
Secret Key
Region
Output format
✅ After this setup, Terraform can interact with your AWS account.
🎯 Objective
Understand Terraform workflow
Learn core commands
Perform hands-on execution
🧱 Step 0: Create Terraform Configuration File
👉 Create a file:
main.tf
👉 This file contains your Terraform infrastructure code
⚙️ Step 1: Initialize Terraform
🔹 Command:
terraform init
🔹 Purpose:
Initializes working directory
Downloads required providers
Prepares environment
✅ Step 2: Validate Configuration
🔹 Command:
terraform validate
🔹 Purpose:
Checks syntax of
.tffilesEnsures configuration is valid
👉 “Check if your code is correct”
📊 Step 3: Review Execution Plan
🔹 Command:
terraform plan
🔹 Purpose:
Shows what Terraform will do
Lists resources to create/change/destroy
Works as a dry run
👉 “Preview before execution”
🚀 Step 4: Apply Configuration
🔹 Command:
terraform apply
🔹 Purpose:
Executes the plan
Creates real infrastructure
👉 Type yes to confirm
🧨 Step 5: Destroy Infrastructure
🔹 Command:
terraform destroy
🔹 Purpose:
Deletes all resources
Avoids unnecessary cloud cost
⚡ Auto-Approve Option
terraform apply -auto-approve
terraform destroy -auto-approve
👉 Skips confirmation
👉 Useful in automation (CI/CD)
👨💻 About the Author
“A complete Terraform series covering everything from fundamentals to advanced real-world infrastructure automation in a DevOps environment.”
📬 Let's Stay Connected
📧 Email: gujjarapurv181@gmail.com
🐙 GitHub: github.com/ApurvGujjar07
💼 LinkedIn: linkedin.com/in/apurv-gujjar






