What is Terraform?
Terraform lets you declare cloud infrastructure — servers, networks, databases — in configuration files, then creates and updates it to match. Instead of clicking through a console, you describe the desired state and Terraform makes reality agree, predictably and repeatably.
Why it matters
Click-ops infrastructure is impossible to review, reproduce, or recover. Infra as code makes your environment versioned, peer-reviewed, and rebuildable from scratch. Terraform is the most widely used IaC tool, so it is a near-universal DevOps expectation.
What to learn
- Declarative configuration and the desired-state model
- Providers and resources
- The
planthenapplyworkflow - Variables, outputs, and locals
- Modules for reusable infrastructure
- The dependency graph Terraform builds
- Reading a plan before applying it
Common pitfall
Running apply without reading the plan. The plan shows exactly what will be
created, changed, or destroyed — and "destroy" can mean deleting a database.
Always read the plan, especially the destroy lines, before approving. Automating
apply without a reviewed plan is how infrastructure gets wiped.
Resources
Primary (free):
- Terraform — Documentation · docs
- Terraform — Get started tutorials · docs
- Terraform — Language reference · docs
Practice
Use Terraform to create a couple of related cloud resources — say a network and
a small instance — with variables for names. Run plan, read it, then apply.
Change a variable, plan again, and see the diff. Run destroy and watch it
remove everything. Done when you read every plan before applying.
Outcomes
- Declare infrastructure as code with providers and resources.
- Use the plan/apply workflow and always review the plan.
- Parameterize with variables and expose outputs.
- Package reusable infrastructure into modules.