Home › Certifications › Terraform Associate (004)
250 multiple-choice questions, 150 flashcards and 10 scenario simulations, organised into 8 chapters, written to the HashiCorp Certified: Terraform Associate 004 blueprint. Every question carries a full rationale.
Study Terraform Associate (004) in CoStudy →
HashiCorp Certified: Terraform Associate 004 — launched 8 January 2026, superseding 003 which retired 7 January 2026. The exam tests Terraform 1.12 (003 tested 1.3). Eight objectives: IaC concepts; Terraform's purpose and fundamentals; the core workflow; reading, generating and modifying configuration; modules; state; maintaining infrastructure; and HCP Terraform — HashiCorp does not publish objective weights. Multiple choice with true/false, single-answer and multiple-answer question types, 60 minutes, $70.50, online proctored, valid 2 years. HashiCorp publishes neither the question count nor the passing score. Terraform Cloud was renamed HCP Terraform in 2024; Terraform Enterprise remains the self-hosted offering.
CoStudy's Terraform Associate (004) bank holds 410 items organised into 8 chapters that follow the published blueprint. Every multiple-choice question carries a written rationale explaining why the correct answer is correct and why each distractor is tempting but wrong, and the bank includes 10 scenario-based simulations.
Each chapter follows a domain of the published exam outline. Practise one on its own:
A sample of 24 multiple-choice questions from the bank, with the full rationale shown.
Which capability most distinguishes Terraform from AWS CloudFormation?
Answer: D — Terraform manages resources across many providers from a single configuration language.
D is right: the provider plugin model lets one HCL configuration span AWS, Azure, Google Cloud, Kubernetes, SaaS platforms and on-premises systems, and reference values across them. A is wrong because both tools are declarative. B is wrong — Terraform authenticates to every provider it touches. C is doubly wrong: Terraform's default backend is local, not S3, and CloudFormation does track stack state, just on the service side rather than in a file you own.
Which of the following is NOT a benefit of Infrastructure as Code?
Answer: C — Running infrastructure is guaranteed never to drift from the committed configuration
C is right as the non-benefit: drift still happens because people and other automation change resources out of band. IaC narrows the window and gives you the tools to detect it — a refresh-only plan surfaces the difference, and managing drift is an examinable objective — but nothing about writing code prevents someone editing a resource in the console. A, B and D are genuine, routinely cited advantages.
Which statement BEST captures the difference between a declarative tool such as Terraform and an imperative provisioning script?
Answer: A — The configuration states the desired end state and Terraform derives the actions needed to reach it
A) Correct — you describe the end state; Terraform compares it with reality and computes the actions. B) is a direction reversal: it describes the imperative model, which is exactly what Terraform is not. C) is false; declarative tools handle deletions by removing the block and applying. D) inverts the durability argument — the declarative file is the reusable artifact.
In the expression provider = aws.west, what is 'aws.west'?
Answer: C — A reference to the aws provider configuration carrying the alias 'west'
C is right: the meta-argument selects which provider configuration a resource or module uses, and the part after the dot is the alias declared on a second provider block. A reads it as a resource address, which uses the same dotted shape and is the natural misread. B invents a module output of a provider. D confuses provider selection with workspaces. Omit the argument and the resource takes the default, unaliased configuration for its type.
A reviewer sees a `required_providers` block in a colleague's configuration and asks where it legally belongs. The correct answer is that it must appear:
Answer: D — Nested inside the `terraform` block, which is where provider requirements are declared
D) Correct — `required_providers` is a nested block of the `terraform` settings block. A) is the most common authoring error; a top-level `required_providers` is not valid. B) confuses requirements with configuration: the `provider` block holds settings such as region and credentials, not source and version. C) is wrong on both counts — `backend` configures state storage and is itself nested in the `terraform` block.
What is a Terraform 'provider'?
Answer: D — A plugin that talks to a specific API, turning configuration into calls on that service
D is right: providers are plugins that implement resource and data source types and translate configuration into API calls; they are declared in required_providers and installed by init. A is a module, B is tooling, C is a backend and E is a workspace - all distinct from the plugin layer that actually reaches the platform.
Which command formats Terraform configuration files to canonical style?
Answer: D — terraform fmt
Trick: the command is 'fmt' (like gofmt), not 'format' or 'style'. -check returns nonzero if files would be changed (useful in CI).
During an outage an engineer uses `-target` to apply a single resource, and afterwards proposes making it the team's standard practice to keep applies fast. The BEST response is:
Answer: D — Reject it: targeting is documented for exceptional recovery, and routine use leaves state inconsistent with the configuration
D) Correct — HashiCorp positions `-target` as an escape hatch for recovering from errors, warning that habitual use produces state that no longer reflects the whole configuration. A) is the misconception the warning exists to counter; splitting configurations is the supported answer to slow plans. B) narrows the bad advice without fixing it — targeted destroys carry the same inconsistency risk. C) confuses two unrelated flags: skipping refresh changes how state is reconciled, not which objects are in scope.
A team runs 'terraform plan' but skips saving the plan file with -out. What is the risk on apply?
Answer: A — apply recomputes the plan, which may differ from the one that was reviewed.
A is right: without -out there is no artifact to hand to apply, so apply re-plans from current state and real infrastructure, and the result can differ from what a reviewer approved. B assumes a plan cache that does not exist. C is wrong because apply runs happily with no plan file, just with a confirmation prompt. D names a file Terraform never writes. For change control, always run plan -out=FILE and apply that exact file.
Which CLI argument file format does Terraform automatically load if present in the working directory?
Answer: A — terraform.tfvars, terraform.tfvars.json, and any file ending in .auto.tfvars
A is right: those are the only names Terraform loads without being told to, and any other .tfvars file must be passed with -var-file. B confuses declaration with assignment — a .tf file declares variables and may carry defaults, but it is not an argument file. C is not a format Terraform reads at all. D invents a dotenv convention. Values from auto-loaded files are overridden by -var and -var-file on the command line.
Which practice is LEAST appropriate for handling secrets in a Terraform configuration?
Answer: B — Committing a terraform.tfvars file containing the API token
A) Sensitive workspace variables are a standard, audited injection path. B) Correct — committing plaintext credentials to version control exposes them to everyone with repository access and is the practice to avoid. C) Environment variables keep the value out of files, a common and accepted approach. D) Fetching from a secrets manager keeps the value out of the repository.
Which is true about 'depends_on' on a module block?
Answer: A — depends_on is supported on module blocks and applies to the module as a unit
A is right: a module block accepts depends_on, and every resource inside the module inherits that dependency, which is useful when a whole module must wait on something Terraform cannot infer. B is the misconception that the meta-argument is resource-only. C invents a companion attribute. D wrongly narrows the effect to providers. Use it sparingly, since implicit dependencies through input variables and outputs are usually clearer.
Which module source string would Terraform interpret as a local path (no download)?
Answer: B — ./modules/vpc
Trick: local paths must start with './' or '../'. A bare 'modules/vpc' is treated as a registry shorthand and would fail to resolve.
A module is called with `source = "./modules/network"`. Which statement about this call is correct?
Answer: B — The module is read from the local filesystem, so no download occurs and no `version` argument applies
B) Correct — a source beginning with `./` or `../` is a local path; the module is used in place, and version constraints are meaningless because there is no versioned artifact. A) is wrong: local modules are referenced where they sit, not vendored into `.terraform`. C) inverts the rule — the leading `./` is exactly what marks a path as local, and without it Terraform interprets the string as a registry address. D) is false in both halves: module sources are resolved during init, though edits to a local module need no re-download.
Which source can a module be referenced from?
Answer: C — Local paths, public or private registries, Git, generic HTTP, S3, GCS and Bitbucket URLs
C is right: the source argument accepts local paths, registry addresses, Git and Mercurial URLs, HTTP archives and object storage in S3 or GCS. A, B, D and E each name one real source type and then wrongly exclude the rest; version constraints apply to registry sources, while Git sources pin with ref.
What is the Terraform state file?
Answer: E — A JSON record mapping configuration to real infrastructure; keep it in a remote backend
E is right: terraform.tfstate is JSON that binds each configuration address to a real object, and teams should hold it in a locking, encrypted backend such as S3, Azure Storage, GCS or HCP Terraform. B is the dangerous one: state cannot simply be rebuilt, and losing it orphans resources. A, C and D misdescribe both the format and the purpose.
An engineer wants to inspect drift without altering the persisted state file. The BEST command is:
Answer: B — terraform plan -refresh-only
A) The refresh-only apply is what commits the updated state. B) Correct — a refresh-only plan reports the differences between state and real infrastructure and, being a plan, writes nothing. C) Pulling and pushing state moves data around and risks overwriting it. D) refresh also updates the persisted state rather than merely reporting.
Which sequence is correct for moving a project from local to a remote S3 backend?
Answer: D — Add the backend block, run terraform init, and accept the migration prompt.
D is right: init detects that the configured backend differs from the recorded one and offers to copy existing state into the new location. A throws away the only record of your infrastructure before the migration can read it. B refreshes state but does nothing about where it lives. C is the hand-editing trap — serial and lineage fields are Terraform's business. Configure encryption and locking on the bucket as part of the same change.
A `moved` block with from = aws_instance.old and to = aws_instance.new has what effect?
Answer: D — Renames the state address to aws_instance.new, leaving the real resource alone.
D is right: the moved block records a refactor, so Terraform updates the address in state and the plan shows a move rather than a replacement. A is exactly what happens if you rename the resource without the block, which is why it tempts. B confuses the operation with a refresh. C would create a duplicate entry. Because it lives in configuration, a moved block is reviewable and runs for everyone, unlike a one-off CLI invocation.
Which command lists every resource address currently tracked in state?
Answer: C — terraform state list
Trick: 'state list' is the subcommand. There is no top-level 'terraform list'. Useful for scripting targeted operations.
What does 'terraform import' do?
Answer: D — Brings an existing resource created outside Terraform under management, recorded in state
D is right: import associates an existing object with a configuration address so Terraform starts managing it; you still write the matching resource block. The config-driven import block is the modern form, since it shows up in plan and can generate configuration. A and B are init behaviours, C is variable loading and E is not what import does.
The same set of cloud credentials variables must apply to twenty workspaces without being retyped. The BEST feature is:
Answer: C — A variable set scoped to the relevant workspaces or project
A) Registry modules distribute configuration code, not workspace variable values. B) Sentinel evaluates policy against plans; it does not supply variables. C) Correct — variable sets define variables once and apply them to chosen workspaces or an entire project. D) Run triggers queue runs based on another workspace's apply; they carry no variables.
A networking workspace's apply must automatically queue a run in a dependent application workspace. The correct feature is:
Answer: B — A run trigger on that workspace
A) The data source reads outputs but does not initiate a run. B) Correct — a run trigger configured on the downstream workspace queues a run there whenever the upstream workspace completes an apply. C) Projects group workspaces for organisation and permissions, without any execution linkage. D) Variable sets share values, not run scheduling.
Which statement about state in HCP Terraform is MOST accurate?
Answer: B — State is versioned, and prior versions can be inspected or rolled back
A) Locking is automatic for workspace state and needs no separate configuration. B) Correct — HCP Terraform retains a version history of workspace state, which supports auditing and recovery. C) State is durable; it would be useless if discarded after each run. D) Committing state to version control leaks secrets and duplicates the authoritative copy.
6 sample cards from the 150 in the bank.
Multi-user collaboration?
Remote state + locking. CI/CD pipeline. HCP Terraform features.
What range of versions does the constraint ~> 1.4.2 permit, and how does that differ from ~> 1.4?
~> 1.4.2 allows 1.4.2 up to but not including 1.5.0 — only the patch component may increment. ~> 1.4 allows 1.4 up to but not including 2.0 — the minor component may increment. The pessimistic operator always lets only the rightmost component you actually wrote move upward.
TF_LOG environment variable?
Sets verbosity. TRACE, DEBUG, INFO, WARN, ERROR. TRACE most verbose.
terraform init -upgrade?
Force upgrade providers/modules to latest acceptable versions.
What is infrastructure as code (IaC), and what are its three headline advantages?
IaC is the practice of defining and provisioning infrastructure through machine-readable configuration files that are versioned and applied automatically rather than built by hand. Headline advantages: repeatability and consistency across environments, version control with peer review and an audit trail, and automation that removes slow, error-prone manual console work.
terraform plan?
Preview changes. Shows what will be added, changed, destroyed.
These samples are a small slice. The full bank runs flashcards, multiple choice and timed mock exams with per-chapter progress tracking, on the web and in the iOS app.
Open Terraform Associate (004) →
The Terraform Associate (004) bank holds 410 items: 250 multiple-choice questions, 150 flashcards and 10 scenario-based simulations. 30 of them are on this page to read free, with no signup.
Yes. Every multiple-choice item carries a written rationale that states the controlling principle behind the correct answer and then addresses each wrong option in turn — why it tempts and precisely where it fails. Knowing why the plausible answer was wrong is worth more than knowing which letter was right.
It is organised into 8 chapters that follow the published exam blueprint: IaC Concepts and Terraform's Purpose; Providers and Terraform Fundamentals; The Core Workflow; Reading, Generating and Modifying Configuration; Modules; State; Maintaining Infrastructure; HCP Terraform. The number of questions in each chapter is proportional to that domain's published weight, so working through the bank exposes you to roughly the mix the real exam uses.
HashiCorp Certified: Terraform Associate 004 — launched 8 January 2026, superseding 003 which retired 7 January 2026. The exam tests Terraform 1.12 (003 tested 1.3). Eight objectives: IaC concepts; Terraform's purpose and fundamentals; the core workflow; reading, generating and modifying configuration; modules; state; maintaining infrastructure; and HCP Terraform — HashiCorp does not publish objective weights. Multiple choice with true/false, single-answer and multiple-answer question types, 60 minutes, $70.50, online proctored, valid 2…
The samples on this page are free to read in full, rationales included, with no account. The complete 410-item bank, the timed mock exams and per-chapter progress tracking are part of CoStudy on the web and in the iOS app.
Last reviewed 2026-08-22. Banks are written against the certifying body's published exam outline and re-checked when that outline changes — exams get renumbered, retired and reweighted, and a bank written to a superseded outline teaches the wrong proportions. Figures that are re-indexed annually are deliberately not asserted as rules; the questions test the governing principle instead.
This bank is written against HashiCorp's published exam material. Check the HashiCorp certification exam objectives for the current outline, fees and eligibility rules — those change, and the certifying body is the only authority on them. CoStudy is not affiliated with HashiCorp.