π Terraform Series β Day 4

Gujjar Apurv is a passionate DevOps Engineer in the making, dedicated to automating infrastructure, streamlining software delivery, and building scalable cloud-native systems. With hands-on experience in tools like AWS, Docker, Kubernetes, Jenkins, Git, and Linux, he thrives at the intersection of development and operations. Driven by curiosity and continuous learning, Apurv shares insights, tutorials, and real-world solutions from his journeyβmaking complex tech simple and accessible. Whether it's writing YAML, scripting in Python, or deploying on the cloud, he believes in doing it the right way. "Infrastructure is code, but reliability is art."
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






