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.
- Create a Terraform project with AWS provider config.
- Prefer
aws_security_groupwith tags (or a tinyaws_instanceonly if you already know EC2 from AWS course and reuse existing subnet/VPC IDs via variables). - Add variables + gitignored
terraform.tfvars+example.tfvars. terraform init→plan→apply.- Record the output id in your notes.
- Change one tag;
plan/applyagain; observe update. terraform destroyand confirm the resource is gone.- Confirm
.gitignorecovers 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;
planbeforeapply;destroywhen 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.