This section focuses on the essential Terraform concepts you need early in your study path. If you’re preparing for the HashiCorp Certified: Terraform Associate exam, these topics map closely to the exam’s foundational objectives.
What is Terraform?
Terraform is an open-source Infrastructure as Code (IaC) tool by HashiCorp that lets you define cloud and on-prem resources declaratively using configuration files (typically with the.tf extension). Terraform transforms those declarative files into an execution plan and then applies that plan to create, update, or destroy resources across multiple providers (AWS, Azure, GCP, and many others).
Key verbs you’ll use frequently:
terraform init— initialize a working directoryterraform plan— preview changes before applyingterraform apply— execute the planned changesterraform destroy— remove managed infrastructure
Why organizations use Terraform
Terraform introduces consistent, reproducible, and auditable infrastructure automation. Instead of manual clicks or scattered CLI scripts, Terraform gives you:- Declarative configuration: describe desired state, not imperative steps.
- Multi-cloud and provider support: one tool for many platforms.
- Versionable configurations: treat infrastructure like code in git.
- Predictable change plans: preview changes with
terraform plan. - Reusable modules: encapsulate and share architecture patterns.
Core Terraform concepts
| Concept | Purpose | Example/Notes |
|---|---|---|
| Configuration | Declare resources and settings | Files with .tf using HCL (HashiCorp Configuration Language) |
| Provider | Plugin for a target platform | provider "aws" { region = "us-east-1" } |
| Resource | A managed infrastructure object | resource "aws_instance" "web" { ... } |
| State | Maps config to real resources | Stored locally or remotely (S3, Terraform Cloud) |
| Plan/Apply | Preview and enact changes | terraform plan → terraform apply |
| Module | Reusable configuration unit | Local or registry-based modules for reuse |
Terraform state contains the authoritative mapping of resources. Protect and manage state carefully (use remote backends and locking for teams) to avoid resource drift and corruption.
How Terraform improves workflows
- Automation and CI/CD: Integrate Terraform into pipelines to provision and update infrastructure automatically.
- Collaboration: Use remote state backends and workspaces to coordinate changes among teams.
- Drift detection:
terraform plansurfaces differences between configuration and real infrastructure. - Idempotence: Reapplying the same configuration converges the environment to the declared state.
Common usage pattern
- Write configuration (
*.tffiles). - Initialize the working directory:
terraform init
- Validate and preview changes:
terraform validateterraform plan
- Apply changes:
terraform apply
- Maintain and update through version control and CI.
Next steps and references
- Official Terraform documentation: https://www.terraform.io/docs
- HashiCorp Learn: https://learn.hashicorp.com/terraform
- Course link (exam prep): HashiCorp Certified: Terraform Associate 004
- Create a simple provider configuration and one resource.
- Initialize with
terraform init, plan withterraform plan, and apply withterraform apply. - Configure a remote backend (e.g., S3 with DynamoDB locking for AWS) to experiment with team workflows.