Q1. Which of the following is not a benefit of IaC (Infrastructure as Code)?
ExplanationIaC is an improvement in how infrastructure is managed; it does not change the price sheet. Reproducibility, version control, and consistency are the keywords of the correct axis, and inflated options like automatic cost reduction or eliminating outages at the source are the standard bait in this domain.
Q2. Which statement most accurately describes Terraform’s configuration model?
ExplanationTerraform configuration captures “what you want” and not the procedure. plan computes the execution plan from the difference against the current state. A describes the shell-script approach.
Q3. What do you call the property that running Terraform apply multiple times with the same configuration produces the same result?
ExplanationIf everything already matches the desired state, apply does nothing, so it is idempotent. Questions that ask for the term itself actually appear, and they aim at confusion with atomicity (all or nothing).
Q4. What is the structural reason Terraform can support so many clouds and SaaS products?
ExplanationTerraform core handles graph computation and plan and state management, while the actual API calls are handled by the provider plugins downloaded during init. This division of labor is the structural background of the ecosystem’s breadth.
Q5. Which best describes the fundamental purpose of Terraform state?
Explanationstate is the mapping that grounds the comparison between code and real infrastructure, along with a record of resource attributes and dependencies. Without state, Terraform cannot know what it is managing.
Q6. What is HashiCorp’s official position on provisioners?
ExplanationProvisioners run scripts outside the declarative model, so failure handling and idempotency are weak, and the official documentation classifies them as a last resort. Image building or dedicated configuration management tools are the recommended direction.
Q7. What range does the version constraint ~> 6.2 allow?
ExplanationThe tilde operator allows only the rightmost specified component to increase. ~> 6.2 allows 6.2, 6.3, … up to 6.x and blocks 7.0. Also keep the difference in mind: ~> 6.2.0 would allow only up to 6.2.x.
Q8. Which statement about the .terraform.lock.hcl file is correct?
ExplanationIf required_providers is the allowed range, the lock file is the pinned record of the exact versions chosen within it. Committing it makes the team and CI use the same versions. The trap: the “lock” in the name has nothing to do with state locking.
Q9. Which command upgrades the provider versions recorded in the lock file to the latest within the allowed range?
Explanationinit -upgrade reselects the newest versions within the constraint range and updates the lock file. C and D are commands that do not exist.
Q10. How do you use the same AWS provider twice with different region settings?
ExplanationYou register the provider block with an alias and pick it on resources with provider = aws.alias. The us-east-1 requirement for CloudFront certificates is the classic case. Most resources have no region argument.
Q11. Which is the recommended way to manage provider credentials?
ExplanationHardcoded credentials always point in the wrong direction. Environment variables, shared credentials files, and roles from the execution environment (EC2 instance profiles, OIDC in CI) point in the right direction.
Q12. Which statement about the .terraform directory is correct?
Explanation.terraform is a local cache that init can rebuild at any time, and it belongs in .gitignore. Another point of distinction: the lock file (.terraform.lock.hcl) is a separate file outside this directory.
Q13. What are the three stages of the Terraform core workflow as HashiCorp defines it?
ExplanationThe official three stages are Write, Plan, Apply. init is a preparation command, and destroy is an alias for apply -destroy — the framing that neither is a separate stage also gets tested.
Q14. Which situation does not require re-running terraform init?
Explanationinit’s job is preparing the backend, providers, and modules. Editing resource arguments belongs to plan and apply, so no init is needed.
Q15. How do you apply exactly what you reviewed in plan, with no changes slipping in between?
ExplanationApplying a saved plan file applies that plan as-is with no recalculation. B leaves a gap, and C merely skips the prompt while still recalculating. This is the standard pattern in CI pipelines.
Q16. What is the current way to force a single resource you suspect is damaged to be recreated on the next apply?
Explanation-replace is the successor standard to the taint command. taint is on its way out, B risks duplicate creation, and D is delete-then-create, which breaks ordering and references.
Q17. Which statement about the -target flag is most accurate?
Explanation-target can create divergence between code and infrastructure, so it is for exceptional situations such as incident recovery. Options that recommend everyday use point in the wrong direction.
Q18. Which statement about terraform validate is correct?
Explanationvalidate catches errors in the configuration itself, such as undeclared variables or wrong argument names. There is no cloud connection, so no credentials are needed, and it needs provider schemas, so it runs after init. B is fmt’s job, and D is the job of plan -refresh-only.
Q19. Which setting writes the most detailed Terraform debug logs to a file?
ExplanationDebug logging is enabled with the TF_LOG environment variable, not a command flag, and TRACE is the most verbose level. TF_LOG_PATH specifies the file path. B, C, and D do not exist.
Q20. Which command does the same thing as terraform destroy?
Explanationdestroy is an alias for apply -destroy. plan -destroy is only a preview of the deletion plan and does not execute it, and state rm only removes a resource from management without deleting it.
Q21. With the default (local backend) behavior, where is state stored?
ExplanationLocal-backend state lives in terraform.tfstate in the working directory. The trap is the distinction that the .terraform directory is the plugin and module cache.
Q22. Which is not an advantage that a remote backend provides over local state?
Explanationplan’s calculation logic is the same regardless of the backend. The value of a remote backend is sharing, locking, and storage durability.
Q23. You run apply and get “Error acquiring the state lock”. What should you do first?
ExplanationThe lock is normal behavior that prevents concurrent runs, so in most cases waiting is the answer. force-unlock is a last resort after confirming that no run is active — unlocking an in-progress run turns into a concurrent state-write accident.
Q24. Which statement about terraform force-unlock is correct?
Explanationforce-unlock does nothing but remove a leftover lock marker. It neither repairs state nor stops another run.
Q25. What happens when you run terraform state rm?
Explanationstate rm erases only the mapping record — removal from management. Actually deleting the resource is the job of destroy or of removing the code and applying, and that distinction is the core exam point for this command.
Q26. What is the declarative way to rename a resource block while avoiding recreation?
ExplanationA rename is computed as “destroy + create” by default, so you have to announce the address move with a moved block (or the imperative state mv). There is no automatic recognition like D.
Q27. What is the current standard for bringing an existing resource that was first created in the console under Terraform management?
ExplanationThe import block (1.5 and later) is the reviewable standard path, and -generate-config-out can draft the code as well. A attempts duplicate creation and B risks corruption — both are off-limits.
Q28. Which statement about the value of a variable marked sensitive = true is correct?
Explanationsensitive is display masking only. The fundamental answer to the plaintext-state problem is write-only arguments, and the operational answer is encryption and access control on the state storage.
ExplanationThe configuration in the execution directory is the root module, and what you call through module blocks are child modules. The framing that every configuration is at least one module (the root) gets tested.
Q30. For which source is the version argument of a module block valid?
Explanationversion is registry-source only. Git sources pin with the ref query in the URL, and local paths have no version concept — they resolve to the files as they exist at that moment.
Q31. How does the calling side read a value that a child module created?
ExplanationModules are encapsulated, so only values exported as outputs are readable. If the value you need has no output, the answer is to add an output to the module.
Q32. After adding a new module block, plan fails with a “Module not installed” error. What is the fix?
ExplanationInstalling modules is init’s job. After adding a module or changing a source, run init again.
Q33. Which statement about the verified badge on the public registry is correct?
Explanationverified is a partner-verification mark — neither a usage restriction nor a security guarantee. You evaluate a module through the registry’s input and output documentation and the source.
Q34. What happens if you do not specify version for a registry module?
ExplanationOmitting version means tracking the latest, so a new version someone publishes can change your plan without warning. That is why pinning module versions is the basic habit for reproducibility. The lock file is for providers and does not record module versions.
Writing Configuration and Custom Conditions (Q35–Q41)
#
Q35. When values arrive for the same variable through multiple channels, which one is applied in the end?
ExplanationPrecedence runs environment variables → terraform.tfvars → auto.tfvars → command line, with later entries winning. Command-line assignment is the strongest.
Q36. Which statement about locals is correct?
ExplanationDeclaration uses the plural locals, reference uses the singular local — a fiddly little trap in the spelling. The role split also gets tested: external input is variable, internal computation is locals.
Q37. You want to read a user-data script file while substituting variables into it. Which function fits?
Explanationtemplatefile reads the file while substituting the variables you pass in. file only reads the content with no substitution. It is the go-to function for building user_data.
Q38. Which command lets you experiment with expression results interactively without an apply?
Explanationconsole is the interactive tool that reads the current configuration’s variables and resources while you experiment with expressions. The eval and expression commands do not exist.
Q39. Inside a resource’s lifecycle block, what validates “assumptions that must hold before this resource is evaluated”?
Explanationprecondition covers assumptions before evaluation, and postcondition guarantees the result after evaluation. validation validates variable inputs, and check is continuous validation that does not block apply — this four-way distinction is the axis of the domain.
Q40. Which keyword references the resource’s own attributes inside a postcondition?
ExplanationInside postcondition you reference your own evaluated attributes with self (for example, self.architecture). this is a naming convention for resources inside modules, not a keyword, and each is the iteration variable of for_each.
Q41. Which custom condition leaves only a warning on failure instead of blocking apply?
ExplanationOnly the check block is non-blocking. It continuously monitors infrastructure conditions (a certificate nearing expiry, and so on) without stopping deployment, while the other three stop plan and apply on failure.
New Scope: ephemeral and Meta-Arguments (Q42–Q46)
#
Q42. Which statement about ephemeral values is correct?
Explanationephemeral values leave no record and exist only during a run, which makes them well suited to handling secrets. Being evaluated fresh on every run is what separates this from B.
Q43. How do you later rotate the value of a write-only argument such as password_wo on aws_db_instance?
ExplanationThe value is not in state, so Terraform cannot detect the change — incrementing the version number is the rotation trigger. This “undetectable → version trigger” logic is the core of write-only questions.
Q44. When is using depends_on justified?
ExplanationDependencies are inferred automatically from references, so depends_on is reserved for hidden dependencies that references cannot express. Unnecessary declarations only reduce parallelism and slow apply down.
Q45. With resources created from a list-based count, what happens when you remove an element from the middle of the list?
ExplanationA count resource’s identity is its index, so removing a middle element shifts every element after it. for_each, which is safe because it is key-based, is the answer to this trap, and the criteria for choosing between the two come up repeatedly.
Q46. Which setting blocks, at the Terraform level, a production database from accidentally being included in a deletion plan?
Explanationprevent_destroy blocks with an error the moment a deletion plan is generated. Its limits get tested as a bundle: it cannot stop console deletion, and the protection disappears together with the block if the block is deleted.
Q47. Which statement about HCP Terraform workspaces is correct?
ExplanationAn HCP workspace shares only its name with CLI workspaces — it is a separate concept, the platform’s management unit that bundles state, variables, history, and permissions. A project is the higher-level structure that groups multiple workspaces.
Q48. What is the standard way to supply common cloud credentials to multiple workspaces?
ExplanationA variable set is the answer for a shared bundle of variables. Also remember the precedence: workspace-level variables override a variable set.
Q49. Which Sentinel policy level blocks on violation but allows an authorized person to override and proceed?
Explanationsoft-mandatory means “block, but overridable.” hard-mandatory is a block with no bypass, and advisory only leaves a warning. The three-level distinction is such a staple that it is almost the entirety of policy questions.
Q50. What is Terraform Enterprise?
ExplanationEnterprise is the self-hosted edition of the same family of features. All you need is its position: the form for organizations that cannot place data in an external SaaS.
35 or more questions (70%) counts as ready to book. For the questions you missed, find the matching part in the domain distribution table and go back — in particular, the custom conditions in #7 and the new scope in #8 are new in 004, so if your wrong answers cluster there, reinforce those first. Before booking, I recommend going through the official study guide and the sample questions once to get familiar with how the exam phrases things.
The series-guided study ends here. The 26-part Terraform basics, practice, and operations track that this certification line is built on carries the practical depth, so whenever exam prep surfaces a concept your hands do not remember, drop down to the track anytime and pair it with hands-on work. Good luck on the exam.