
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
About the author
- 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."
Comments
Join the discussionNo comments yet. Be the first to comment.
Terraform
๐ Terraform Series โ Automate Your Infrastructure Starting a complete **Terraform series** where Iโll cover everything from **basic to advanced level** with real-world practicals. In this series, you will learn: โข What is Infrastructure as Code (IaC) & why it matters โข Terraform fundamentals (providers, resources, state) โข Writing and managing Terraform configurations โข Variables, outputs & modules โข Remote state & state management โข Provisioning infrastructure on AWS โข Automation & real-world use cases โข Advanced concepts like workspaces, modules, and best practices ๐ฏ Goal: Help you automate infrastructure and become job-ready in DevOps. Perfect for **beginners, students, and DevOps learners** who want hands-on experience. Stay tuned and letโs build infrastructure the smart way โก๐ป #Terraform #DevOps #Cloud #AWS #InfrastructureAsCode #Automation






