HashiCorp Certified: Terraform Associate
Validates the fundamentals of Infrastructure as Code with Terraform — the write→plan→apply workflow, state, modules, configuration, and HCP Terraform. One of the fastest, highest-value cloud certs to earn: most people pass in 1–2 weeks.
57 questions
60 minutes
pass ~70%
$70.50 USD
Valid 2 years
Part 1 — High-Level Overview
What & Why
The Terraform Associate proves you understand Infrastructure as Code and can operate Terraform's core workflow confidently — initialize a project, plan and apply changes, manage state, use modules, write HCL, and understand what HCP Terraform (the SaaS platform) adds. It's vendor-neutral (works with AWS, Azure, GCP, and hundreds of providers) and widely respected in DevOps hiring.
Exam at a Glance
| Attribute | Value |
| Exam | HashiCorp Certified: Terraform Associate (004) |
| Questions | 57 |
| Question types | Multiple choice, multiple answer, true/false, text-match (fill-in-the-blank) |
| Time | 60 minutes |
| Passing score | ~70% (not officially published; scaled) |
| Cost | $70.50 USD (+ tax) |
| Delivery | Online, webcam-proctored (PSI / Certiverse). Near-instant results. |
| Validity | 2 years · Language: English only |
→ Deep dive: §1 Exam Details
The 8 Objectives
| # | Objective | Deep dive |
| 1 | Infrastructure as Code (IaC) with Terraform | → §2 |
| 2 | Terraform fundamentals (providers, how state is used) | → §3 |
| 3 | Core Terraform workflow (init / plan / apply / destroy) | → §4 |
| 4 | Terraform configuration (resources, variables, expressions, custom conditions, secrets) | → §7 |
| 5 | Terraform modules | → §6 |
| 6 | Terraform state management | → §5 |
| 7 | Maintain infrastructure (import, inspect state, verbose logging) | → §5 |
| 8 | HCP Terraform | → §8 |
Terraform version tested: 1.12. The exam is heaviest on configuration, the core workflow, and state — spend your time there.
CLI Snapshot
Core workflow
init →
plan →
apply →
destroy;
fmt,
validate.
→
State
state list/show/mv/rm,
import, remote backends, locking.
→
Config
variables & precedence,
data, functions,
count vs
for_each, lifecycle.
→
Modules
sources, inputs/outputs, versioning, registry.
→
Providers
required_providers, version constraints (
~>), lock file.
→
HCP Terraform
remote runs, VCS, private registry, Sentinel policy.
→
Recommended Materials (community consensus)
The consensus stack: one foundation course (Zeal Vora Udemy #1, or KodeKloud for browser labs, or freeCodeCamp/Andrew Brown free) → build a small real project (providers, variables, modules, remote state, workspaces) → grind Bryan Krausen's practice exams (the near-universal #1, ~300 Q / 5 exams) to 85–90%+ → HashiCorp's own tutorials/docs. Avoid dumps.
→ Full breakdown with sources (§9)
Study Plan (Quick Version)
- Learn by building: watch one course while doing labs; then build a real project — the generation effect makes it stick.
- Master the CLI & state: drill exact command behavior (state rm/import/mv, apply savedplan, validate) — the exam is precise.
- Active recall: flashcard the traps (count vs for_each,
~>, Cloud-only features, provisioners-last-resort).
- Practice: Krausen exams to consistent 85%+, review every miss against docs, then book.
→ Detailed retention-based plan (§10) · ⚡ Cram Jam
Part 2 — Thorough Study Guide
1 · Exam Details
- 57 questions in 60 minutes (~63 seconds each). Feels tight on scenario items — flag-and-return.
- Four question types: multiple choice, multiple answer, true/false, and text-match / fill-in-the-blank (type the exact command or value — so know CLI spelling).
- Passing score ~70% (~40/57); HashiCorp doesn't publish the exact cut score.
- $70.50, online webcam-proctored, English only, results near-instant by email. Cert valid 2 years.
- No hard prerequisite. Recommended: basic terminal skills, cloud familiarity, and hands-on Terraform.
- Tested against Terraform 1.12 — questions reflect current CLI behavior, HCL features (custom conditions, dynamic expressions), and HCP Terraform.
2 · IaC Concepts & Why Terraform
- Infrastructure as Code (IaC) = define infrastructure in declarative config files, version-controlled and repeatable. Benefits: consistency, repeatability, versioning, automation, self-documentation, reduced human error.
- Declarative (Terraform, describe desired end state) vs imperative (scripts, describe steps).
- Why Terraform specifically: cloud/provider-agnostic (one workflow across AWS/Azure/GCP + hundreds of providers), a huge provider ecosystem, and state that maps config → real resources so it can plan precise changes.
- Purpose of state: track real-world resources, store metadata, improve performance, and enable collaboration.
Terraform vs the alternatives (a stated objective)
| Tool | How Terraform differs |
| CloudFormation / ARM-Bicep | Vendor-locked to one cloud; Terraform runs the same workflow across any provider — the answer to "multi-cloud IaC." |
| Ansible / Chef / Puppet | Primarily configuration management (software on existing machines, often procedural); Terraform is provisioning (create/modify/destroy the infrastructure itself, declarative). They complement: Terraform builds the VM, Ansible configures it. |
3 · Terraform Basics & Providers
- Plugin-based architecture: Terraform Core talks to providers (plugins) via RPC. Providers implement resources/data sources for a platform.
- Declaring providers (in a
terraform block):
terraform { required_providers { aws = { source = "hashicorp/aws", version = "~> 5.0" } } }
- How Terraform finds providers: from the public Terraform Registry by default (namespace/type), downloaded during
terraform init into .terraform/.
- Version constraints:
=, !=, >=, <=, and the pessimistic ~>: ~> 5.1 allows 5.x ≥ 5.1 (not 6.0); ~> 5.1.2 allows 5.1.x only. required_version pins the Terraform CLI.
.terraform.lock.hcl (dependency lock file) records the exact provider versions selected — commit it.
- You can use multiple providers (and multiple configurations of one provider via
alias — e.g. two AWS regions; select with provider = aws.west on a resource).
- Provider authentication: never hard-code credentials in config. Providers read environment variables (e.g.
AWS_ACCESS_KEY_ID), shared credential files/profiles, or ambient identity (instance roles, OIDC). Hard-coded keys end up in VCS — the "which is the secure approach?" answer is always env vars / dynamic credentials.
4 · Core Workflow & CLI
The core workflow is Write → Plan → Apply. Know the exact behavior of each command — the exam tests it precisely.
| Command | What it does (and gotchas) |
terraform init | Initializes the working dir: downloads providers & modules, configures the backend. Flags: -upgrade, -reconfigure, -migrate-state, -backend=false. Run it first / after adding providers or modules. |
terraform plan | Dry run — shows what will change. -out=planfile saves a plan; -target limits scope; -refresh-only previews drift. |
terraform apply | Provisions. apply planfile applies a saved plan without prompting. -auto-approve skips the yes/no. -replace=ADDR recreates a resource. |
terraform destroy | Tears everything down (alias for apply -destroy). -target for partial. |
terraform fmt | Rewrites config to canonical style. -check, -recursive, -diff. Only formatting. |
terraform validate | Checks syntax/internal consistency only — does NOT contact providers/APIs and needs no credentials. Requires init first. |
terraform console | Interactive REPL to test expressions, functions, and interpolations against state. |
terraform output / show / graph / version | Read outputs; human/JSON view of state or a plan; dependency graph; version. |
- Verbose logging: set
TF_LOG=TRACE|DEBUG|INFO|WARN|ERROR (TRACE is the most verbose; and TF_LOG_PATH to write to a file) for debugging.
taint/untaint mark a resource for recreation but are deprecated — use apply -replace=ADDR instead (know both).
- Plan symbols:
+ create · - destroy · ~ update in place · -/+ destroy then recreate (a "forces replacement" attribute changed). Reading a plan snippet is a common question format.
- CLI workspaces:
terraform workspace new/select/list/show/delete — multiple state files for one configuration (e.g. dev/stage); interpolate the current one with terraform.workspace. Every config starts in the default workspace, which can't be deleted.
5 · State
- Default backend is local (
terraform.tfstate on disk). Remote backends (S3, azurerm, gcs, consul, pg, kubernetes, HCP Terraform via the cloud block) enable team collaboration.
- Backend syntax: declared inside the
terraform block — terraform { backend "s3" { bucket = "…", key = "…", region = "…" } }. Backend config can't use variables/interpolation; missing values can be supplied at init time (partial configuration via -backend-config). Changing backends requires re-running init (-migrate-state to carry state over).
- State locking prevents concurrent writes from corrupting state. Remote backends support it (e.g. S3 historically used a DynamoDB lock table; HCP Terraform locks automatically).
-lock=false and terraform force-unlock exist for edge cases.
- Secrets in state: state stores values in plaintext, including secrets. Never commit state to VCS; use an encrypted remote backend and restrict access.
sensitive = true only hides values in CLI output — they're still in state.
terraform_remote_state data source reads outputs from another config's state (cross-config wiring).
- Drift = real infra differs from state; detect with
plan / apply -refresh-only.
State-manipulation commands (top exam trap — memorize the semantics)
| Command | Effect |
state list | List resources tracked in state. |
state show ADDR | Show attributes of one resource. |
state mv | Rename/move a resource in state — refactor without destroy/recreate. |
state rm ADDR | Remove from state; the real resource is NOT destroyed — Terraform just "forgets" it. |
import ADDR ID | Bring existing infra into state. The CLI form does NOT generate configuration — you must write the resource block yourself. |
Config-driven import & refactoring (the modern way)
- Declare an
import { to = aws_x.this, id = "…" } block in your configuration, then run terraform plan / apply. Unlike the CLI command, this is reviewable in a plan and version-controlled.
terraform plan -generate-config-out=generated.tf will scaffold the resource configuration for imported resources so you don't hand-write it.
moved { from = aws_x.old, to = aws_x.new } blocks are the config-driven equivalent of state mv — rename/move resources (including into modules) without destroy/recreate, reviewable in the plan.
removed blocks are the config-driven state rm — stop managing a resource without destroying it.
6 · Modules
- A module is a reusable container of resources. The top level is the root module; it calls child modules.
- Sources: local paths (
./modules/x), the Terraform Registry (namespace/name/provider), Git/GitHub (git::https://…, ?ref=v1.2.0), Bitbucket, S3/GCS buckets, HTTP.
- Versioning:
version = "~> 3.0" works for registry modules; for Git, pin with ?ref=<tag>. Local paths don't take a version.
- Inputs = input variables (
variable blocks); outputs = output blocks that expose values to the parent. Variables are scoped to their module — there are no global variables.
- Calling a module:
module "vpc" { source = "terraform-aws-modules/vpc/aws", version = "~> 5.0", cidr = "10.0.0.0/16" } — arguments map to the module's input variables. Read its outputs as module.vpc.vpc_id. After adding/changing a module, run terraform init (or get) to download it.
- A module can only see what's passed in and only exposes what it outputs — parents can't reach arbitrary resources inside a child. That encapsulation is the tested concept behind "variable scope within modules."
- Registry modules marked verified are reviewed by HashiCorp; the registry documents inputs/outputs and gives the version constraint to copy.
7 · Configuration & HCL
Variables & precedence (low → high)
- Environment variables (
TF_VAR_name)
terraform.tfvars
terraform.tfvars.json
*.auto.tfvars / *.auto.tfvars.json (alphabetical)
-var and -var-file on the CLI (highest; last one wins)
Variable types. Primitives (string, number, bool); complex types — collection (list, set, map) and structural (object, tuple). Modifiers: default, sensitive, nullable, validation. A variable with no default and no supplied value → Terraform prompts interactively.
Named values — how you reference things
var.name = input variable · local.name = local value · module.name.output = child-module output · type.name.attr = resource attribute · data.type.name.attr = data source.
locals define named expressions computed once and reused (locals { common_tags = { env = var.env } } → local.common_tags) — DRY for repeated expressions; unlike variables, they can't be set from outside.
- Outputs:
output "ip" { value = aws_instance.web.public_ip } — shown after apply, read with terraform output, and the interface between modules. sensitive = true redacts it in CLI output.
Resources, data sources & references
resource "type" "name" {} manages infra; data "type" "name" {} is a read-only lookup refreshed during plan.
- Cross-resource references connect resources: refer to another resource's attribute as
type.name.attribute (e.g. aws_vpc.main.id).
- Implicit dependencies form automatically when one resource references another; add an explicit
depends_on only when there's no reference. Terraform builds a dependency graph (DAG) and parallelizes independent resources.
Dynamic configuration — expressions & functions
- Built-in functions transform values: string (
join, split, format, replace), collection (length, lookup, merge, concat, flatten), numeric, encoding (jsonencode), and more. Test them in terraform console.
- Conditional expression:
condition ? true_val : false_val.
for expressions transform lists/maps: [for s in var.list : upper(s)].
dynamic blocks generate repeated nested blocks from a collection (e.g. many ingress rules) instead of copy-paste.
- Splat expressions (
aws_x.this[*].id) collect an attribute across all instances.
count vs for_each
count | for_each |
Indexed: aws_x.this[0] | Keyed over a map/set: aws_x.this["key"] |
| Good for N identical copies | Preferred when items are distinguishable |
| Removing a middle item reindexes → churn | Stable keys → no reindex churn (each.key, each.value) |
lifecycle meta-arguments
create_before_destroy = true — build replacement before destroying the old one.
prevent_destroy = true — hard-block deletion (plan errors out).
ignore_changes = [attr] (or all) — ignore drift on specific attributes.
- Also meta-args:
depends_on, count, for_each, provider.
Custom conditions & validation
- Variable validation: a
validation { condition = … , error_message = … } block inside a variable rejects bad input early (e.g. enforce an instance-type prefix or a CIDR shape).
- Preconditions & postconditions: a
lifecycle { precondition {…} / postcondition {…} } block on a resource/data source asserts assumptions before and guarantees after apply — failing the plan/apply with your message if violated.
check blocks define scoped assertions (with optional data sources) that report warnings without blocking apply — good for continuous validation of a deployment.
Managing sensitive data
- Mark inputs/outputs
sensitive = true to keep them out of CLI output — but remember they are still stored in state, so protect state itself.
- Don't hard-code secrets in
.tf files or commit .tfvars with secrets. Inject them at runtime via environment variables (TF_VAR_*) or a secrets manager.
- Best practice is to pull secrets from a dedicated store — e.g. the Vault provider / data sources — rather than storing them in configuration. Ephemeral values/resources let sensitive data flow through a run without being persisted to state.
Provisioners — last resort
local-exec, remote-exec, file. HashiCorp says provisioners are a last resort — prefer native provider resources. on_failure = continue|fail; creation-time vs destroy-time. Expect a "which is best practice?" question favoring native resources.
8 · HCP Terraform (formerly Terraform Cloud)
- Remote runs (plan/apply executed in HCP) and remote state storage with automatic locking & encryption.
- VCS integration (GitHub/GitLab/Bitbucket) → speculative plans on PRs, run triggers.
- Private module & provider registry.
- Workspaces (org-level — different from CLI workspaces) and projects.
- Sentinel policy-as-code (and OPA) for governance; cost estimation; run tasks; team/SSO/RBAC; variable sets.
- Editions: Free / Standard / Plus. The exam tests which features are Cloud/Enterprise-only (Sentinel, cost estimation, run triggers, SSO, remote state sharing).
CLI workspaces ≠ HCP workspaces terraform workspace (CLI) manages multiple state files for one config, referenced via terraform.workspace. HCP workspaces are org-level managed environments. Don't confuse them.
9 · Study Materials (community consensus)
Averaged from Reddit (via Reddemy comment-ranking) and multiple first-hand "how I passed" write-ups — which converge tightly on the same two names.
1 · Video courses
| Course | Why |
| #1Zeal Vora — Terraform Associate (Udemy) | The single most-upvoted Terraform course on Reddit; ~11.5h, exam-focused. People pass in ~2 weeks. Caveat: bring your own AWS account for labs. |
| KodeKloud — Terraform for Beginners w/ Labs | Best for hands-on learners: browser-based labs (no cloud account needed), animations, "learn then use it." Also on LinkedIn Learning. |
| FreefreeCodeCamp — Andrew Brown (ExamPro) | Free ~7–12h YouTube course aligned to the cert, with a free 57-Q practice exam. |
| Bryan Krausen / Derek Morgan | Krausen has a prep course + 70+ hands-on labs (better known for practice exams, below). Derek Morgan for deeper projects. |
2 · Practice exams most important
Near-universal #1: Bryan Krausen's "Terraform Associate Practice Exam" (Udemy) — ~300 unique questions across 5 timed full-length exams, "almost identical to the real exam," with explanations + doc links, and filterable by topic so you can drill weak areas. The repeated winning combo is Zeal Vora + Krausen practice exams. Also: ExamPro's free 57-Q exam, Whizlabs, HashiCorp's official sample questions.
3 · Hands-on & free
- HashiCorp developer tutorials + official docs — free, authoritative, and quoted verbatim in real exam questions. Read them.
- Local Terraform CLI + a real provider (AWS/Azure/GCP free tier, or Docker/LocalStack to avoid cloud spend). Build a real project using remote state, modules, and workspaces rather than reading linearly.
- KodeKloud free labs; freeCodeCamp course.
4 · Books / notes
- The Packt "HashiCorp Terraform Associate Exam Guide" is the main dedicated book. Community cheat-sheet write-ups (codingnconcepts, Hakan Bayraktar) are widely shared. Keep your own notes — that's this guide's Cram Jam.
Sources
10 · Study Plan (Retention-Based, ≈1–2 weeks)
Terraform is a hands-on skill, so the fastest path to both passing and retaining it is the generation effect — writing and running the config yourself. Reading docs is necessary but not sufficient; typing terraform apply against real resources is what makes the concepts stick.
| Principle | How to apply it to Terraform |
| Learn by doing | Build a real project (VPC/VM + variables + a module + remote state + a workspace). Don't just watch. |
| Active recall | Quiz yourself on exact CLI behavior and the state-command semantics; use flashcards for the traps. |
| Spaced repetition | Short daily reviews of commands/constraints; re-drill misses from practice exams at intervals. |
| Elaboration (Feynman) | Explain out loud why state rm doesn't destroy, or when for_each beats count. |
| Phase | Focus | Actions |
| Days 1–4 | Foundations + workflow | Watch Zeal Vora / KodeKloud / freeCodeCamp. Install Terraform; run init/plan/apply/destroy against a real provider. Write variables, outputs, a data source. |
| Days 5–8 | State + modules + config | Set up a remote backend; practice state list/mv/rm/import; build & call a module; use count vs for_each and lifecycle rules. Explore HCP Terraform's free tier. |
| Days 9–12 | Practice + gaps | Grind Krausen's 5 practice exams; review every wrong answer against the docs; drill weak objectives by topic filter until consistently 85–90%+. |
| Day 13–14 | Polish + taper | Official sample questions to confirm format; skim the Cram Jam; light review; sleep well; book it. |
Faster (1 week) with prior IaC/cloud experience; 2–4 weeks at 1–2 hrs/day if newer.
Readiness bar You're ready when you can explain from memory what state rm vs import vs state mv do, when to use for_each over count, what ~> 5.1 allows, and which features are HCP/Enterprise-only — and you're consistently 85%+ on Krausen.
11 · Tips & Common Traps
- State semantics (top trap):
state rm forgets but doesn't destroy; import adds to state but doesn't write config; state mv refactors without destroy/recreate.
count vs for_each — reindex churn with count; stable keys with for_each.
- Version constraint
~> behavior and the lock file.
- Cloud/Enterprise-only features — Sentinel, cost estimation, run triggers, remote state sharing, SSO. Know the boundary vs Community edition.
- Provisioners are a last resort — favor native provider resources.
- Exact CLI behavior:
validate needs no credentials/API; apply savedplan doesn't prompt; fmt only reformats; init downloads providers/modules.
- Fill-in-the-blank questions mean you must know exact command spelling — practice typing them.
- Pace: 57 Q / 60 min ≈ 63 s each. Flag-and-return on scenarios.
Ignore Exam dumps (ExamTopics "actual questions", etc.) — they violate HashiCorp's certification agreement and risk decertification, are often outdated, and are unnecessary given Krausen/ExamPro. Also make sure any course you pick is current (aligned to the latest objectives and Terraform 1.12 — avoid stale 2021/2022 titles).
↑ back to top