Terraform: पहिला Plan आणि Apply
Read this guide in: English · मराठी · हिंदी
Why Terraform हवा आहे? कारण cloud resources फक्त click history असतील तेव्हा developers आणि operations मध्ये problem येतो. Developers ला app साठी VPC, VM किंवा storage हवे. Operations — server / cloud side — प्रत्येक आठवड्याला console वेगळ्या प्रकारे click करतो. कोणी काय तयार केले हे कोणालाच आठवत नाही. Terraform .tf files मध्ये resources declare करतो: init → plan → apply → lab संपली की destroy. Apply आधी plan वाचा.
मित्रांनो, console वर click करून cloud बनवला की नंतर “कोणी काय केले?” विचार येतो. Terraform म्हणजे code मध्ये लिहा, plan वाचा, मग apply.
थोडक्यात उत्तर
हे पाच पॉइंट्स लक्षात ठेवा:
- Developer — app साठी cloud resources हवेत.
- Operations — cloud/server-side person ज्याला काय आहे आणि का हे माहीत असावे.
- Problem — फक्त clicks; drift; “कोणी तयार केले?”; surprise bills.
- Terraform — code desired cloud सांगतो; plan preview; apply reality बदलतो.
- लक्षात ठेवा: init → plan (वाचा) → apply → labs destroy.
Language: English · मराठी · हिंदी
Problem? Suppose we are…
Suppose we are building Instagram (like updates)
कोणी console मध्ये bucket आणि VM click केले. सहा महिन्यांनी production कोणी तयार केले हे माहीत नाही. Friday ला चुकीचे resource delete.
Suppose we are working at Netflix and we are giving updates
वारंवार releases — प्रत्येक environment सारखा infra shape. फक्त clicks ने Netflix-scale identical ठेवता येत नाही.
Suppose you are working in Infosys on a client project
Client operations म्हणतो: “आमच्या account मध्ये काहीतरी तयार करण्याआधी plan दाखवा.” terraform plan ती conversation.
स्वतःच्या cloud account चे credentials, budget alerts. Invented prices नाहीत — provider pricing pages पाहा. Secrets / terraform.tfstate उघड commit करू नका.
Terraform reads .tf files, shows a plan (+/~/-), then apply makes infrastructure match the code.
Terminal-style teaching diagram: terraform init, plan, apply with a local lab example — not a fake AWS console.
Terraform कसे उत्तर देते
mkdir tflab && cd tflab
terraform version
terraform init
terraform plan
terraform apply
terraform destroy
Minimal .tf — फक्त तुम्हाला परवानगी असलेल्या provider/resource साठी, वर्तमान HashiCorp registry docs वापरा:
terraform {
required_version = ">= 1.5.0"
}
# provider + resource official docs वरून
Ravindra Bagale's Tip
Init संपताच apply करू नका. Plan अनिवार्य वाचन. Client account वर डोळे बंद OK click नाही. Labs शक्य तितक्या त्याच दिवशी destroy. लक्षात ठेवा.
Learn it properly
समजलं का? Why Terraform = click mystery थांबवा; Instagram / Netflix / Infosys “suppose”; init → plan → apply → destroy. प्रत्येक plan वाचा.
Frequently asked questions
What is Terraform?
An infrastructure-as-code tool: you declare desired cloud resources in files, and Terraform calls provider APIs.
What is state?
Terraform records what it created in a state file so later plans know the real world.
Why plan before apply?
Plan is a dry run. Apply makes real changes — always read the plan.
Is local state OK for learning?
Yes for solo labs. Teams use remote state backends — learn that after the first apply.
Terraform vs Ansible?
Terraform shines at provisioning infrastructure. Ansible shines at configuring software on machines.
How do I avoid surprise bills?
Use tiny resources, set billing alerts in your cloud, and destroy labs when finished.