Terraform Infrastructure Engineer Professional (002) Study Guide: Four Traces That Solve Most Scenarios
The Terraform Infrastructure Engineer Professional exam is written for people who already run Terraform in production. Its questions rarely ask what a command is. They show you a configuration, a plan or a pipeline that behaves strangely and ask why, or what the result will be. Of the 252 TF-IEP002 questions in this question bank, 105 (42%) are troubleshooting scenarios, about twice the share in our Terraform Associate (004) set (55 of 266). This guide therefore teaches four traces: follow the value, follow the address, follow the secret and follow the run. Almost every scenario is solved by one of them.
Study guide · HashiCorp Certified: Terraform Infrastructure Engineer Professional (002) (TF-IEP002)

The exam in brief
Multiple choice, proctored online, in English, 90 minutes, testing Terraform 1.15. HashiCorp does not publish the number of questions, the pass mark or domain weights; check the official exam page. Our practice sets group the content into seven areas: configuration; state management and upgrades; workflow and lifecycle; CI/CD; security, secrets and compliance; modules and the registry; and HCP Terraform operations. Those names are our labels, not official domain titles. About 18% of our questions ask for more than one answer; when a question states a number, pick exactly that many.
Trace 1: follow the value
When a resource ends up with the wrong value, walk the chain the value should have travelled: a tfvars file or -var sets a root variable, the variable feeds a local, the local feeds an argument, and for a module the root must pass the value explicitly. Typical breaks:
- The module call never passes it. The root sets
instance_type, but themoduleblock does not, so the child uses its own default. Nothing is shared by name between modules. - Null versus empty string.
var.name != nullis true for"", so an empty string flows through.coalesce()skips both null and empty strings. A caller that passesnulloverrides the default unless the variable is declarednullable = false. - The template cannot see it. Inside
templatefile()only the keys of the vars object exist; a module variable not passed in causes an error. - The module is a closed box.
module.network.aws_subnet.private.idis an error. Only declared outputs leave a module. mergeis shallow. A nestedtagsmap in the second argument replaces the first one entirely.
Beginner tip: keep terraform console open while you study this domain. Type each function from a practice question into it before you look at the options: cidrsubnet("10.1.0.0/16", 4, 3), element(["a","b","c"], 4), try(...), merge(...), a for expression with and without .... You will soon predict the result before pressing Enter, and that is the skill the exam measures.
Going deeper: predicting cidrsubnet without guessing
cidrsubnet(prefix, newbits, netnum) lengthens the prefix by newbits and picks subnet number netnum, counting from zero. For ("10.1.0.0/16", 4, 3): /16 plus 4 bits is /20. A /20 holds 4,096 addresses, which is 16 steps in the third octet, so subnet N starts at third octet N × 16. Subnet 3 is therefore 10.1.48.0/20. The common mistake is to multiply by the number of new bits (3 × 4 = 12). Work out the block size first, then the position. cidrhost works the same way from the network address, and an index past the end of the block is an error.
Trace 2: follow the address
Terraform tracks every instance by its full address. When a plan wants to destroy something nobody meant to touch, the address changed. Ask what renamed it.
countpositions shift. Remove the middle element of a list and every later index points at a different item, so they are updated or replaced.for_eachuses keys, so only the removed key goes.for_eachrules. It takes a map or a set of strings, not a list. Keys must be known at plan time, so IDs created in the same apply cannot be keys. A sensitive value cannot be used as keys.- Refactors need
moved. Renaming a block, switching tofor_eachor renaming a key all need amovedblock, one per instance where needed. Addingcountto a single resource is the exception: Terraform proposes moving the object to index[0]by itself, though an explicitmovedblock is still recommended. Shipped inside a shared module, the block fixes every consumer's state on their next plan;state mvwould have to be run in each state by hand. - Stop managing without destroying. Use a
removedblock withlifecycle { destroy = false }. Runningstate rmwhile the resource block stays in the code creates a duplicate on the next apply. - Cross-state links are invisible. Renaming an output that other configurations read through
terraform_remote_statebreaks them on their next plan. Add the new output next to the old one, move the consumers, then remove the old output.
Trace 3: follow the secret
For every security scenario, ask where the value ends up: screen, state, plan file, log or version control.
| Technique | Where the value still goes |
|---|---|
sensitive = true | Hidden on screen; still in state and saved plan files in cleartext. terraform output -json prints it. |
| Ephemeral resource or variable | Nowhere persistent; usable only in places that are never stored, such as provider blocks, locals and write-only arguments. |
Write-only argument (_wo) | Sent to the provider, then discarded. Needs provider support. |
| Committed tfvars file | Git history, clones and forks. Rotate the secret first, then remove the file. |
| Dynamic provider credentials | A short-lived identity token per run; no stored key at all. The cloud trust policy should match the token's audience and subject. |
Going deeper: why a rotated write-only password can produce "No changes"
Terraform keeps no copy of a write-only value, so it cannot compare the new value with the old one, and a changed password alone produces no diff. Providers therefore pair such arguments with a version argument, for example password_wo_version. Terraform does store that number. Incrementing it in the same change as the new value gives the plan something to compare, the provider sees an update, and it sends the new write-only value. A scenario in which the pipeline supplies a rotated secret but the database keeps the old password is testing exactly this. Tie the version to the secret store's own version metadata so rotation drives the update.
Trace 4: follow the run
Many scenarios are really about where and how a run executes.
- Reviewed is not applied. A pipeline that approves one plan and then runs
apply -auto-approvewithout a plan file applies a new plan. Save with-outand apply that file; a stale saved plan is refused. The file holds sensitive values in cleartext and does not include providers, so the apply job must run init with the same lock file. - Exit codes.
-detailed-exitcodereturns 0 (no changes), 1 (error) or 2 (changes). A script that fails on any non-zero code breaks on a valid plan. - Locks. The default
-lock-timeoutis 0s, so a second pipeline fails at once; add a timeout or serialize jobs. Useforce-unlockonly when the holder is really dead. - Workspace and variable file disagree.
workspace select devfollowed by-var-file=prod.tfvarsraises no error. Nothing links the two. - HCP Terraform execution mode. In local mode nothing is injected, so credentials kept in a variable set never reach the laptop. Agents need only outbound connections. Changing mode breaks runs that have already planned.
- VCS triggers. With path-based triggering ("Only trigger runs when files in specified paths change"), changes outside the listed paths, such as a shared module folder, start no run until a trigger pattern or prefix includes them. A new workspace needs its first run started by hand.
- Policy. Sentinel has advisory, soft-mandatory and hard-mandatory levels; OPA has advisory and mandatory. The scope sits on the policy set.
Trace 1: follow the value
Trace 2: follow the address
Trace 3: follow the secret
Trace 4: follow the run, where and how it executes
Tie-breakers when two options both work
Prefer the option that is least privileged, reviewed before apply, and consistent with documented behavior in Terraform 1.15. Be suspicious of routine -target, -lock=false, -reconfigure to silence a backend error (it does not migrate the existing state), and CLI workspaces as an access boundary for production. If an option relies on something the question does not state, it is probably wrong.
A study order
- Configuration: tracing values, functions and expressions,
countandfor_each, custom conditions. - State: backends, locking, migration, drift,
movedandremoved, upgrades of the CLI and providers. - Workflow: splitting projects, plan modes, saved plans, import, environments, failed runs.
- Pipelines and secrets together, since most security questions happen inside a pipeline.
- Modules and
terraform test, then HCP Terraform operations; finish with timed mixed sets.
Practise
Practise in the question bank: every question explains each option, right and wrong. Start with the domain you just studied, then take a timed mock exam.
- TF-IEP002 exam page · All 312 TF-IEP002 questions · Timed mock exam · 20-day study plan
- By domain: Terraform configuration · State management and upgrades · Infrastructure workflow and lifecycle · CI/CD and deployment · Security, secrets and compliance · Modules and the registry · HCP Terraform operations
Exam facts as described in HashiCorp's exam content for the Terraform Infrastructure Engineer Professional (002). Question count, pass mark and weights are not published; check the official exam page.