Ravindra BagaleCourses & study guides

Chapter 12: Terraform Introduction

12.12 Lab — apply a tiny resource, then destroy

Lab

Use Terraform for one small badge API lab resource, then clean up.

  1. Create a Terraform project with AWS provider config.
  2. Prefer aws_security_group with tags (or a tiny aws_instance only if you already know EC2 from AWS course and reuse existing subnet/VPC IDs via variables).
  3. Add variables + gitignored terraform.tfvars + example.tfvars.
  4. terraform init → plan → apply.
  5. Record the output id in your notes.
  6. Change one tag; plan/apply again; observe update.
  7. terraform destroy and confirm the resource is gone.
  8. Confirm .gitignore covers state and personal tfvars.

Practice task

Explain in six lines why committing terraform.tfstate is dangerous and what you use instead for teammate onboarding (example.tfvars, remote state later).

Thodkyaat sangaycha tar

  • Terraform describes desired cloud state; plan before apply; destroy when labs end.
  • Providers talk to APIs; resources are tracked in state — treat state as sensitive; do not commit it.
  • Start minimal (SG + tags); do not rebuild VPC/DNS — use AWS course + existing IDs.
  • Variables/outputs make labs reusable; gitignore personal tfvars and state.
  • Terraform provisions; Ansible configures — keep the boundary clear.
  • No invented prices — stop idle resources and destroy after practice.

Samajla ka? Nasel tar lab (12.12) plan→apply→destroy paryant sodu naka – state Git baher. Aata pudhe jaauya monitoring basics kade.