Home / HashiCorp Certified: Terraform Associate (003) / Mock exam
HashiCorp Certified: Terraform Associate (003) Exam-style mock test

HashiCorp Terraform Associate (003) Practice Exams|Practice test

Full explanations Exam format Pass line 70%
33 USD One-time · lifetime access
Enroll →

Sample questions

Example1 · IaC Concepts and Terraform Purpose
A payments platform team provisions settlement gateways by manually clicking through a cloud console each quarter, and no two environments end up identical. They adopt Terraform so the same configuration file produces the same infrastructure every run. Which advantage of infrastructure as code does this most directly deliver?
・Lower cloud billing, since Terraform negotiates cheaper on-demand compute pricing on the team's behalf automatically
Incorrect. Terraform orchestrates provider APIs and does not negotiate or discount compute pricing on the user's behalf.
・Faster network throughput, since Terraform tunes packet routing between the provisioned gateways
Incorrect. Terraform provisions resources through provider APIs and does not tune packet routing or network throughput.
・Automatic encryption, since Terraform encrypts all storage without configuration
Incorrect. Encryption is only applied when the relevant resource arguments request it; Terraform does not encrypt storage implicitly.
✓Repeatability, because the committed configuration yields a consistent result on each apply
Correct. A version-controlled configuration applied repeatedly produces the same infrastructure, which is the repeatability benefit of IaC.
Explanation
IaC's core advantages include versioning, automation, repeatability, and reduced drift. Applying one committed configuration consistently is exactly the repeatability benefit; pricing, routing, and encryption are not automatic effects of adopting Terraform.
Example2 · Terraform Basics and Providers
A retail e-commerce platform's root module declares the AWS provider inside a required_providers block but never runs any init command before planning. What does Terraform do with the provider plugin when the engineer runs `terraform plan`?
・It silently downloads the matching provider plugin during the plan step and caches it in the working directory for later
Incorrect. Terraform does not download plugins during plan; installation happens only in the init step, not implicitly at plan time.
・It skips the AWS provider entirely and plans only resources needing no plugin
Incorrect. Terraform cannot plan resources whose provider plugin is absent, and it does not partially skip providers to continue.
・It reads the plugin from the OS package manager path without downloading
Incorrect. Provider plugins come from the registry during init, not from an OS package manager path on disk.
✓It errors out and asks the engineer to run `terraform init` first because the plugin is missing
Correct. Provider plugins are installed during `terraform init`; running plan or apply first fails with an error instructing you to initialize the working directory.
Explanation
Provider plugin installation is bound to `terraform init`, which reads required_providers and downloads matching plugins. Plan and apply assume the plugins already exist and will error if initialization has not run.
Example3 · Core Terraform Workflow and CLI
A payments engineer at a global bank clones the settlement-ledger repository to a fresh laptop and immediately runs `terraform plan`. Terraform exits with an error about an uninitialized backend and missing provider plugins. Which command resolves this situation?
✓terraform init, which configures the backend and installs the needed provider plugins
Correct. terraform init prepares the working directory by configuring the backend and downloading the required provider plugins so later commands can run.
・terraform refresh, which first reconciles the recorded state against the real remote infrastructure it finds
Incorrect. terraform refresh updates state against real infrastructure but cannot install plugins or configure an uninitialized backend.
・terraform validate, which checks the syntax and the internal consistency of all configuration files present
Incorrect. terraform validate only checks configuration consistency and does not download providers or set up the backend.
・terraform apply, which creates the missing resources and downloads any plugins they happen to require
Incorrect. terraform apply itself depends on an initialized directory, so it also fails before any resource is created here.
Explanation
A freshly cloned configuration has no provider plugins or backend configured. terraform init is the mandatory first step that installs plugins and initializes the backend before plan or apply can succeed.
Example4 · State Management
A genomics platform team runs `terraform state list` after applying a configuration that provisions sequencing pipeline infrastructure. What does this command return?
・A detailed dump of every attribute value, including sensitive ones, for all tracked resources
Incorrect. Dumping full attribute values for a single resource is the job of `terraform state show`, not the list subcommand.
・A preview of the create, update, and destroy actions Terraform intends to perform on the next apply
Incorrect. Previewing planned create, update, and destroy actions is produced by `terraform plan`, not by a state subcommand.
・A list of the provider plugins and module sources that the configuration requires to initialize
Incorrect. Listing required provider plugins and module sources is handled during `terraform init`, not by state list.
✓A list of the resource addresses Terraform currently tracks in state
Correct. `terraform state list` outputs the resource addresses currently recorded in state, one per line.
Explanation
`terraform state list` enumerates resource addresses in state so you can target them with other commands. It does not show attribute values, which is what `terraform state show` provides.
Example5 · Modules
A genomics platform team references a reusable child module from the public Terraform Registry for its sequencing workload. Which module source string correctly targets the registry module published as the "vpc" module under the "terraform-aws-modules" namespace for the aws provider?
・source = "registry.terraform.io://terraform-aws-modules/vpc/aws" with the explicit scheme prefix
Incorrect. Registry sources use the bare NAMESPACE/NAME/PROVIDER form and never a registry.terraform.io:// URI scheme prefix.
・source = "git::terraform-aws-modules/vpc/aws" forcing the generic Git source type
Incorrect. The git:: prefix forces the generic Git source type and expects a repository URL, not a registry shorthand path.
・source = "./terraform-aws-modules/vpc/aws" as a local path relative to the caller
Incorrect. A leading ./ marks a local path source relative to the calling module, so Terraform would look on disk rather than the registry.
✓source = "terraform-aws-modules/vpc/aws" as the plain three-part namespace name provider registry shorthand form
Correct. A public registry module uses the three-part NAMESPACE/NAME/PROVIDER shorthand, so terraform-aws-modules/vpc/aws resolves against the default public registry.
Explanation
Public Terraform Registry modules are addressed with the three-part NAMESPACE/NAME/PROVIDER shorthand, which Terraform expands to the default registry host. URI schemes and git:: or ./ prefixes select entirely different source types.
Example6 · Configuration: Reading, Generating, Modifying
A genomics team provisions a fleet of worker nodes for a DNA sequencing pipeline. Each node needs a distinct name derived from a list, and removing one entry from the middle of the list must NOT force recreation of the nodes after it. Which meta-argument should be used on the aws_instance resource?
✓for_each over a set keyed by node name, so each instance keeps its key
Correct. for_each tracks each instance by a stable string key, so deleting a middle entry only destroys that one instance and leaves the others untouched.
・count with length(var.nodes), which indexes each separate instance strictly by its position in the list
Incorrect. count uses positional indexes, so removing a middle element shifts every later index and forces those instances to be destroyed and recreated.
・depends_on referencing the list variable so Terraform recomputes the ordering on each apply
Incorrect. depends_on only orders operations between resources and does nothing to stabilize instance addressing when a list changes.
・a dynamic block iterating the list to generate one inline instance definition per element
Incorrect. dynamic blocks generate repeated nested blocks inside one resource, not multiple separate instances of the resource.
Explanation
count keys instances by numeric position, so a middle deletion reshuffles indexes and recreates trailing resources. for_each keys instances by a stable identity, which is the correct choice when list membership changes over time.
Example7 · HCP Terraform and Cloud/Enterprise
A logistics firm connects a GitHub repository holding its warehouse-routing configuration to an HCP Terraform workspace using the VCS-driven workflow. An engineer opens a pull request that edits the HCL. What does HCP Terraform do automatically in response to that pull request?
✓It queues a speculative, plan-only run and reports the proposed changes back onto the pull request itself without applying anything to real infrastructure
Correct. A pull request against the connected VCS branch triggers a speculative, plan-only run that surfaces the proposed changes back onto the PR without changing infrastructure.
・It immediately applies the merged configuration to the remote state so the warehouse routing stays current at all times
Incorrect. Applies run only after a merge to the tracked branch (or manual confirmation); a PR never auto-applies, and auto-apply is a separate opt-in setting.
・It copies the branch into the private module registry as a new versioned module release for the team to consume
Incorrect. Publishing a module to the private registry is a deliberate action driven by tags and registry configuration, not something a PR plan performs.
・It blocks the pull request from being merged until an administrator manually uploads a fresh state file for the workspace
Incorrect. HCP Terraform manages state itself in a VCS workspace; no administrator needs to upload a state file, and a PR plan does not gate merges this way.
Explanation
In the VCS-driven workflow, pull requests trigger speculative (plan-only) runs that comment the proposed diff back onto the PR. Applies happen only on merges to the tracked branch, and even then only when auto-apply is enabled or a user confirms.
Example8 · IaC Concepts and Terraform Purpose
A logistics firm keeps its depot network configuration as Terraform HCL files inside a Git repository that every engineer clones. The team lead wants to explain the single biggest benefit this gives over the previous click-through console process. Which outcome does storing infrastructure definitions in version control most directly provide?
・Terraform automatically opens a pull request whenever any live cloud resource is modified by someone outside of the shared repository
Incorrect. Terraform does not watch the cloud and raise pull requests; detecting out-of-band changes requires running a plan or refresh, not a Git hook.
・The remote state file is encrypted at rest and locked so that only one person on the team can ever hold a copy of the repository
Incorrect. Encryption and locking are properties of a remote state backend, not of placing configuration files in a Git repository.
✓Each infrastructure change is tracked with a full commit history, so any past revision can be reviewed, diffed against the current files, and cleanly reverted when needed
Correct. Keeping HCL under version control yields a full, auditable commit history where any past revision can be diffed against the current files, reviewed, and cleanly reverted to a known state.
・Resource drift becomes impossible because Git refuses to accept any commit that would conflict with the current live cloud environment
Incorrect. Version control cannot prevent drift; drift arises from changes made directly to real resources and is surfaced only when Terraform runs.
Explanation
Version control's core IaC advantage is a tracked, reviewable history of every configuration change that can be diffed and reverted. Encryption, locking, and drift detection come from backends and the Terraform workflow, not from Git itself.
Example9 · IaC Concepts and Terraform Purpose
An operations engineer at a smart-factory vendor says she can run the same Terraform configuration against three regions and reliably obtain identical sensor-gateway environments each time. Which IaC advantage is she describing?
・Statefulness, because Terraform keeps a running chronological log of every single console action an administrator performs
Incorrect. State records the resources Terraform manages, not a chronological log of every manual administrator action in a console.
✓Repeatability, because the declared configuration yields the same resulting environment on every apply
Correct. Repeatability means the same source configuration can be applied again and again to yield consistent, identical environments.
・Elasticity, because the gateways scale themselves up and down according to the live telemetry volume
Incorrect. Elasticity is autoscaling driven by runtime load, which is a workload behavior rather than an inherent property of applying IaC.
・Convergence, because Terraform negotiates directly with each separate region's billing API before it provisions
Incorrect. Terraform does not negotiate with billing APIs; provisioning is handled by providers against infrastructure APIs, not cost endpoints.
Explanation
Running one configuration to get identical environments every time is repeatability, a hallmark IaC benefit. Elasticity, state, and billing negotiation describe unrelated concepts.
Example10 · IaC Concepts and Terraform Purpose
A B2B SaaS platform team keeps all its Terraform configuration files in a Git repository and requires every change to go through a pull request before it is applied. Which advantage of infrastructure as code does this workflow most directly enable?
・It removes the need to ever run terraform plan since the reviewers have already approved all configuration file changes
Incorrect. Review of source does not replace terraform plan, which shows the actual resource changes against real state before apply.
・It guarantees that the underlying cloud provider will never introduce any breaking change to the deployed resources here
Incorrect. Source control over your config cannot prevent a provider or cloud vendor from changing its own APIs or behaviors.
・It converts the declarative configuration into an imperative script that provisions resources step by step
Incorrect. Git review does not change Terraform's model; Terraform remains declarative regardless of how changes are approved.
✓Versioning, since each change is tracked, reviewed, and revertible through source control
Correct. Storing configuration in source control and gating changes behind review gives versioned, auditable, reversible history for infrastructure.
Explanation
Keeping configuration in Git and reviewing changes delivers versioning: a tracked, auditable, revertible history of infrastructure. It does not eliminate planning, control the provider, or alter Terraform's declarative model.
Example11 · IaC Concepts and Terraform Purpose
An online gaming studio runs the same Terraform configuration to build identical matchmaking environments in three regions, one after another, each time with no manual clicks in a console. Which pair of IaC advantages does this practice best illustrate?
・Mutable infrastructure and manual patching, since each region is adjusted by hand afterward
Incorrect. The scenario describes no manual clicks, which is the opposite of mutable infrastructure maintained by hand.
・State locking and remote backends, the only mechanisms letting a configuration be reused across regions
Incorrect. Locking and remote backends help teams collaborate safely but are not what makes a configuration reusable across regions.
・Immutable versioning snapshots Terraform captures automatically for each resource
Incorrect. Terraform does not create automatic immutable snapshots of every resource; reuse comes from re-running declarative code.
✓Automation and repeatability, since the same code provisions equivalent environments without manual intervention
Correct. Running the same code to stand up equivalent environments hands-free demonstrates automation and repeatability.
Explanation
Re-running one configuration to produce equivalent environments with no manual steps is the textbook expression of automation and repeatability. Locking, backends, and snapshots are unrelated to why the code is reusable here.
Example12 · IaC Concepts and Terraform Purpose
A state ministry of education keeps its campus network layout in Terraform configuration files tracked in Git. Reviewers can diff each pull request before a change reaches the grid of schools. Which core advantage of infrastructure as code does this workflow most directly demonstrate?
・Mutable infrastructure, because running servers are patched in place without being replaced at all
Incorrect. Mutable infrastructure describes in-place patching of live servers and is unrelated to tracking configuration diffs in a repository.
・Agent polling, because each node repeatedly pulls its desired configuration
Incorrect. Agent polling is a push/pull delivery mechanism of some tools; it does not describe why Git diffs help here.
✓Versioning, because the configuration history is auditable and prior revisions can be restored
Correct. Storing declarative files in Git gives a reviewable, revertible change history, which is the versioning advantage of IaC.
・Horizontal autoscaling, because node counts rise and fall in response to live classroom demand
Incorrect. Autoscaling adjusts capacity at runtime and is a platform feature, not the benefit of version-controlling the source.
Explanation
Keeping declarative configuration in version control produces an auditable, revertible history of every change. That is the versioning advantage of infrastructure as code, distinct from runtime scaling or patch delivery mechanisms.
Example13 · IaC Concepts and Terraform Purpose
A regional energy cooperative provisions identical monitoring stacks for dozens of substations by running the same Terraform configuration with different input variables. Each run reliably produces matching resource sets. Which IaC advantage is primarily at work here?
・Secret rotation, since credentials embedded in the files are cycled automatically on every apply
Incorrect. Terraform does not automatically rotate secrets on apply; hardcoding credentials in files is discouraged, not an IaC benefit.
・Live migration, since running workloads shift between substations without downtime
Incorrect. Live migration of running workloads is a hypervisor capability, not something the repeated application of a config provides.
✓Repeatability, since one tested configuration yields consistent environments across many sites
Correct. Reusing one proven configuration to stamp out consistent environments across sites is the repeatability advantage of IaC.
・Blue-green deployment, since two full parallel stacks always run so traffic can be flipped instantly
Incorrect. Blue-green is a release strategy you must design explicitly; it is not an automatic result of parameterized reuse.
Explanation
Applying one validated configuration with varying inputs to produce matching environments demonstrates repeatability. This reduces manual, error-prone setup across many sites and is a defining IaC advantage.
Example14 · IaC Concepts and Terraform Purpose
A regional insurance carrier keeps its claims-portal infrastructure defined in version-controlled Terraform files reviewed through pull requests. A reviewer asks what concrete benefit this versioning practice adds beyond simply storing text. Which benefit does committing the configuration to Git most directly provide?
・It automatically keeps every live cloud resource synchronized with the committed files even when teammates change infrastructure by hand
Incorrect. Git does not reconcile live resources; drift from manual edits is detected only when Terraform runs a plan against state.
✓It lets reviewers inspect the change history and roll back to a prior known-good revision of the definition
Correct. Version control records every committed change, enabling auditable history and rollback to an earlier revision of the configuration.
・It removes the requirement to run terraform apply because committed files take effect immediately
Incorrect. Committing files never provisions anything; changes take effect only after terraform apply executes.
・It encrypts the stored credentials so secret values can be safely committed into the public repository
Incorrect. Git stores plaintext and does not encrypt secrets, so credentials should not be committed in the first place.
Explanation
Storing configuration in version control gives teams auditable change history and the ability to revert to a prior revision. It does not reconcile drift, apply changes, or protect secrets on its own.
Example15 · IaC Concepts and Terraform Purpose
A hotel-booking platform describes its Terraform workflow as declarative. An engineer new to the team asks how a declarative tool differs from writing a shell script that runs provisioning commands. Which statement best captures the declarative model Terraform uses?
・You author step-by-step imperative commands and Terraform faithfully replays each of them in the exact order you wrote during every single run
Incorrect. That describes an imperative script; Terraform does not simply replay ordered commands you wrote.
・You specify only the differences from last time, so Terraform cannot build infrastructure from an empty starting point
Incorrect. Terraform works from desired state and can create everything from nothing; it is not limited to deltas you hand-write.
✓You describe the desired end state you want, and Terraform then determines the full set of concrete actions needed to reach it from the current state
Correct. In the declarative model you express the desired end state you want and Terraform then computes the full set of operations required to converge to it from the current state.
・You list resources in dependency order manually because Terraform will not compute a graph on its own behalf
Incorrect. Terraform builds a dependency graph automatically from references, so you need not order resources by hand.
Explanation
Declarative configuration means you state the desired outcome and the tool figures out how to achieve it. Terraform derives ordering from a dependency graph rather than requiring imperative, ordered commands.
▶ Try 10 free questions (graded)
Measure your readiness with a full mock exam
All questions · full explanations · lifetime access
Enroll(33 USD)