Terraform Associate Cheat Sheet
HashiCorp Certified: Terraform Associate — Quick reference for the exam
CLI Commands
42terraform initTOPInitializes the directory: downloads providers and modules
terraform init -upgradeUpdates providers to the latest version that meets constraints
terraform init -backend=falseOnly downloads modules, without configuring the backend
terraform init -reconfigureForces backend reconfiguration
terraform init -migrate-stateTOPMigrates state to the newly configured backend
Comparisons
5| Command | Since version | Status | When to use it |
|---|---|---|---|
| terraform taint resource.addr | ≤v0.15.2 | Deprecated | Do not use in new code |
| terraform apply -replace=resource.addr | v0.15.2+ | Recommended | Force recreation of a specific resource |
Quick Reference
36IaC concepts
Terraform is declarative: you describe the desired state, not the steps
Applying the same config multiple times = same result
Plugin that translates HCL into API calls to the cloud provider
Managed unit of infrastructure (aws_instance, azurerm_vm...)
Reads data from existing infrastructure without creating it
Reusable set of resources (folder with .tf files)
Value exported from the state, accessible by parent modules or the user
Input parameter that allows reusing configurations
State lifecycle
terraform.tfstate — maps HCL resources ↔ real resources
Never edit the state manually; use terraform state commands
Enables team collaboration and locking
Prevents corruption when multiple users apply simultaneously
terraform.tfstate.backup: automatic copy of the previous state
Hides the value in logs but it DOES persist in the state
(v1.10+): the value NEVER persists in state or plan
Providers and Registry
registry.terraform.io — public source for providers and modules
Declares which providers the project needs, with version constraints
~> 5.0 accepts 5.x but not 6.0
Pins exact provider versions, must be committed to git
Updates providers while respecting constraints
Modules
Directory where terraform is executed
Referenced with a module {} block from the root or another module
Local path, Terraform Registry, GitHub, S3, GCS
Downloads modules without initializing providers
Allow creating multiple instances of a resource/module
HCP Terraform (formerly Terraform Cloud)
HashiCorp's official remote backend for state management and execution
Isolated environments with their own state
Policy-as-code framework integrated with HCP Terraform
Plans/applies run in the HCP cloud
Private module registry within the organization
Exam tips
DEPRECATED since v0.15.2 → use -replace
DEPRECATED since v0.15.4 → use plan -refresh-only
Opinionated: always produces the same result
.tfvars files are not loaded in child modules, only in the root
for_each requires a set or map; count requires a number
Creates an explicit dependency; Terraform resolves implicit dependencies automatically
Ready to practice?
Put what you learned to the test with original Terraform Associate exam questions.
Start Terraform Associate mock examUnlimited mock exams with the Pro plan