Every Exam PrepFREE EXAM PREP
Ask AI
← All practice tests
PRACTICE ENGINE · TERRAFORM ASSOCIATE

Terraform Associate Practice Test.

65 free practice questions with answers and explanations.

No signup required. Choose a topic and review each answer.

Start practicing →
About these practice questions
Verified against the official content outline

These are original study questions written from published exam objectives—not recalled, copied, or confidential live-exam items. Always confirm current coverage with the official sources linked on this page.

Exam format and study resources

The Terraform Associate is administered by HashiCorp, with a 1 hour time limit.

This free Terraform Associate practice test has 65 original questions written to HashiCorp's official content outline, last checked against it on July 18, 2026. Every question shows a worked explanation, and nothing here requires a signup.

As of 2026, the Terraform Associate exam fee is $70.5.

Difficulty
QUESTION 1 / 65Understand Infrastructure as Code (IaC) conceptsEasy0/0
A team currently provisions cloud servers by manually clicking through a console and keeping a shared spreadsheet of what was created. Which core benefit would adopting Infrastructure as Code (IaC) most directly provide?
0/0session
Browse all questions & answers
  1. 1. A team currently provisions cloud servers by manually clicking through a console and keeping a shared spreadsheet of what was created. Which core benefit would adopting Infrastructure as Code (IaC) most directly provide?

    • A. Infrastructure changes become reproducible and reviewable because they are defined in version-controlled configuration files
    • B. Cloud provider costs are automatically reduced regardless of the resources deployed
    • C. The need for testing before deploying to production is eliminated
    • D. Manual console access is required in addition to the code to keep infrastructure accurate
    Show answer & explanation

    Answer: A
    IaC's core value is treating infrastructure definitions as code: reviewable diffs, version history, and repeatable, auditable changes replace undocumented manual clicks. It does not automatically cut cloud spend, does not remove the need for testing, and it reduces (not adds) reliance on manual console changes since the code becomes the source of truth.

  2. 2. Which statement best describes a key advantage of a declarative IaC approach (like Terraform) compared to a purely imperative scripting approach for provisioning infrastructure?

    • A. You describe the desired end state and the tool determines the steps to reach it, rather than scripting each individual action in order
    • B. Declarative tools never need to communicate with a provider API
    • C. Declarative configurations cannot be reused across environments
    • D. Imperative scripts automatically track infrastructure drift over time
    Show answer & explanation

    Answer: A
    Declarative IaC specifies the desired end state, and the tool computes the plan of actions needed, unlike imperative scripts which encode explicit step-by-step commands. Declarative tools still call provider APIs, are commonly reused across environments via variables, and plain imperative scripts have no built-in drift detection.

  3. 3. An organization wants infrastructure changes to go through the same pull-request review process as application code changes. Which IaC characteristic makes this workflow possible?

    • A. IaC eliminates the need for a version control system entirely
    • B. IaC tools require a dedicated binary configuration format that cannot be diffed
    • C. Cloud providers mandate that all changes be reviewed before an API accepts them
    • D. Infrastructure configurations are stored as plain-text files that can be committed to a version control system
    Show answer & explanation

    Answer: D
    Because IaC configurations are plain text, they can be committed, diffed, and reviewed in version control exactly like application code, enabling PR-based review workflows. IaC tools use human-readable text formats (not undiffable binaries), providers don't enforce review, and version control remains essential rather than eliminated.

  4. 4. A company deploys resources across AWS, Azure, and an on-premises VMware cluster and wants a single tool and workflow to manage all three. Which characteristic of Terraform makes it well suited to this multi-platform scenario compared to a single cloud vendor's native IaC tool?

    • A. Terraform uses a provider plugin model that lets the same workflow target many different platforms through their respective APIs
    • B. Terraform only works with a single cloud vendor at a time and requires separate state files per vendor tool
    • C. Terraform automatically migrates resources between clouds without reconfiguration
    • D. Terraform requires each provider to expose an identical API schema
    Show answer & explanation

    Answer: A
    Terraform's provider plugin architecture abstracts many different platform APIs behind a common configuration language and workflow, which is why it's commonly chosen for multi-cloud/hybrid scenarios, unlike vendor-native tools scoped to one platform. It doesn't migrate resources between clouds automatically, and providers are not required to share an identical schema — each provider maps its own resource types.

  5. 5. A module is sourced from a registry without a version constraint. What risk does this create?

    • A. A later run can pick up a new module version whose behaviour differs, changing infrastructure without any change to the configuration
    • B. The module will fail to download
    • C. The module's outputs become unavailable
    • D. State locking is disabled
    Show answer & explanation

    Answer: A
    Unpinned dependencies make a run's outcome depend on when it happens rather than only on what the configuration says, which defeats reproducibility. Version constraints combined with the dependency lock file are what make a plan produced today reproducible tomorrow.

  6. 6. A provider version constraint is written as pessimistic to the patch level. What does this permit?

    • A. Patch updates within the specified minor version but not a minor or major version change
    • B. Any version newer than the one specified
    • C. Only the exact version specified
    • D. Any version including older ones
    Show answer & explanation

    Answer: A
    The pessimistic constraint accepts bug fixes while excluding the minor version bumps that may introduce behavioural change, which balances staying current against stability. The lock file records exactly which version was selected and its checksums, so a team runs the same provider until the lock is deliberately updated.

  7. 7. Compared to a configuration management tool primarily focused on configuring software on existing servers, what is Terraform primarily designed to manage?

    • A. Real-time application performance monitoring and alerting
    • B. Source code compilation and build artifact packaging
    • C. Installing and updating application packages on an already-running operating system
    • D. The provisioning and lifecycle of infrastructure resources themselves, such as compute instances, networks, and managed services
    Show answer & explanation

    Answer: D
    Terraform's core purpose is provisioning and managing the lifecycle of infrastructure resources (create, update, destroy), whereas configuration management tools focus on configuring software state on already-provisioned machines. Terraform is not a package installer, a monitoring platform, or a build/CI tool, though it is often used alongside such tools.

  8. 8. A team is choosing between Terraform and a mutable, agent-based configuration tool for managing cloud VM infrastructure that is frequently torn down and recreated. Why might Terraform's immutable infrastructure model be preferable in this scenario?

    • A. Replacing resources from a known configuration reduces configuration drift compared to repeatedly mutating long-lived servers in place
    • B. Immutable infrastructure guarantees zero downtime during every apply
    • C. Mutable tools cannot run more than once against the same server
    • D. Immutable infrastructure requires no state tracking of any kind
    Show answer & explanation

    Answer: A
    Terraform's tendency to replace rather than mutate resources in place helps avoid configuration drift that accumulates when servers are patched repeatedly, which fits well with frequently recycled infrastructure. It does not guarantee zero downtime on every apply, mutable tools can absolutely run repeatedly against the same host, and Terraform still requires tracking state to know what exists.

  9. 9. Which of the following is the correct sequence of the core Terraform workflow when making a change to existing infrastructure?

    • A. terraform init, then terraform plan, then terraform apply
    • B. terraform validate, then terraform destroy, then terraform apply
    • C. terraform destroy, then terraform init, then terraform plan
    • D. terraform apply, then terraform plan, then terraform init
    Show answer & explanation

    Answer: A
    The standard core workflow is init (prepare the working directory and providers), plan (preview proposed changes), then apply (execute them) — in that order. Applying before planning skips change review, destroying before initializing is out of order and destructive by default, and validate/destroy/apply is not the standard change workflow.

  10. 10. A developer runs `terraform plan` and sees that an EC2 instance will be destroyed and recreated rather than updated in place, even though only one attribute changed. What most likely explains this behavior?

    • A. The changed attribute requires replacement because the provider cannot update it in place, so Terraform plans a destroy-and-recreate
    • B. terraform plan always destroys and recreates every resource regardless of what changed
    • C. The state file has become corrupted and must be manually deleted
    • D. The developer must run terraform import before any further changes are allowed
    Show answer & explanation

    Answer: A
    Some resource attributes are marked by the provider schema as requiring replacement (ForceNew-style behavior) because the underlying API has no in-place update path for that attribute, so Terraform plans destroy-then-create. Plan does not always destroy every resource, this behavior does not indicate state corruption, and import is unrelated to why a specific attribute forces replacement.

  11. 11. During `terraform apply`, a user is prompted with a plan summary and asked to type 'yes' to proceed. What is the purpose of this interactive approval step in the core workflow?

    • A. It gives the operator a final chance to review the exact set of additions, changes, and destructions before they are applied to real infrastructure
    • B. It permanently locks the configuration files from further edits
    • C. It re-downloads all provider plugins before any resources can change
    • D. It is required only the very first time a workspace is ever applied
    Show answer & explanation

    Answer: A
    The apply confirmation step exists so an operator can review the concrete plan output (adds/changes/destroys) before it's executed against real infrastructure, preventing unintended changes. It does not re-download providers, does not lock config files, and applies every time apply is run interactively, not just the first time.

  12. 12. A CI pipeline runs terraform apply non-interactively for every merge to main. Which flag or approach is appropriate to skip the interactive yes/no confirmation while still applying a specific saved plan?

    • A. Run terraform apply against a previously saved plan file so the exact reviewed changes are applied without re-prompting
    • B. Delete the state file before every apply so no confirmation is needed
    • C. Run terraform taint on every resource before applying
    • D. Disable the provider's authentication so the apply always fails safely
    Show answer & explanation

    Answer: A
    Applying a saved plan file (created via terraform plan -out) in automation lets CI apply exactly the reviewed changes without interactive confirmation. Deleting the state file would cause Terraform to lose track of existing resources and likely attempt to recreate everything; tainting every resource forces unnecessary replacement; and disabling authentication would simply break the pipeline.

  13. 13. A configuration file defines a resource block for an AWS S3 bucket with several arguments and a nested lifecycle block. Which statement correctly describes HCL syntax being used here?

    • A. Resource blocks use a resource type and a local name, and arguments inside are key-value pairs, with nested blocks representing structured sub-configuration
    • B. HCL requires all resource arguments to be defined as separate top-level resource blocks
    • C. Nested blocks like lifecycle can only be used inside variable declarations
    • D. HCL syntax mandates that every block be wrapped in double quotes
    Show answer & explanation

    Answer: A
    HCL resource blocks follow the pattern resource "type" "name" { arguments and nested blocks }, where nested blocks like lifecycle group related structured configuration under the resource. Arguments aren't required to be separate top-level resources, lifecycle blocks are used inside resource blocks (not variable declarations), and blocks are not wrapped in quotes — only certain labels are quoted strings.

  14. 14. A configuration needs to reference the ID of an aws_vpc resource named "main" from within an aws_subnet resource's vpc_id argument. Which expression correctly does this?

    • A. aws_vpc.main.id
    • B. vpc.main.id
    • C. aws_subnet.main.vpc_id
    • D. var.aws_vpc.main.id
    Show answer & explanation

    Answer: A
    Terraform resource references follow the pattern <resource_type>.<local_name>.<attribute>, so aws_vpc.main.id correctly references the id attribute of the aws_vpc resource named main. 'vpc.main.id' omits the required resource type prefix, 'aws_subnet.main.vpc_id' references the subnet's own argument rather than the VPC's exported id, and prefixing with var. is incorrect since this is a resource reference, not an input variable.

  15. 15. A variable block declares `variable "instance_count" { type = number, default = 2 }`. If a caller does not supply a value for instance_count, what value will Terraform use?

    • A. The default value of 2, since no override was supplied
    • B. Terraform will always fail immediately at plan time due to a missing required value
    • C. Terraform will silently substitute the value 0 for any numeric variable without a default
    • D. Terraform will prompt for the value only during terraform destroy
    Show answer & explanation

    Answer: A
    When a variable has a default and no other value is supplied via -var, a tfvars file, or environment variable, Terraform uses that default. It will not fail since a default exists, it does not silently substitute 0 for undeclared defaults, and prompting (when it happens for variables with no default) is not limited to destroy operations.

  16. 16. A configuration must create three nearly identical S3 buckets, differing only by name, based on a list variable containing three strings. Which HCL construct is most appropriate?

    • A. A count or for_each meta-argument on the resource block, iterating over the list to create one instance per element
    • B. Writing three separate, hand-duplicated resource blocks with unique local names
    • C. A provisioner block that loops internally to create each bucket
    • D. A nested module with no input variables at all
    Show answer & explanation

    Answer: A
    count or for_each meta-arguments let a single resource block iterate over a list or map to produce multiple similar resource instances without duplication. Hand-duplicating blocks works but violates DRY and doesn't scale; provisioners run scripts on resources rather than looping resource creation; and a module without any input variables couldn't parameterize the bucket names at all.

  17. 17. An engineer wants to select an appropriate meta-argument for creating multiple resource instances from a map where each resource needs a stable identity even if items are added or removed from the middle of the collection. Why is for_each generally preferred over count in this case?

    • A. count automatically re-keys instances by name whenever the list changes
    • B. count and for_each are functionally identical and interchangeable in every scenario
    • C. for_each cannot be used with modules, only with resources
    • D. for_each keys each instance by a map key or set value, so removing or adding an unrelated element does not shift the index-based identity of other instances
    Show answer & explanation

    Answer: D
    for_each keys instances by a stable map key/set value, so unrelated additions or removals don't shift other instances' identities, whereas count's numeric-index identity can cause unrelated resources to be destroyed and recreated when the list changes. count does not re-key by name, for_each works with both resources and modules, and the two are not interchangeable in every scenario given this indexing difference.

  18. 18. A configuration includes `locals { name_prefix = "${var.environment}-app" }` and later references `local.name_prefix` in multiple resources. What is the primary benefit of using a local value here?

    • A. It computes a derived expression once and gives it a reusable name, avoiding repeating the same interpolation logic across multiple resources
    • B. Local values can be overridden at apply time using a -var flag just like input variables
    • C. Local values automatically become outputs of the root module
    • D. Local values are required before any variable can be declared
    Show answer & explanation

    Answer: A
    Locals let you name a computed expression once and reuse it, reducing duplication and improving readability versus repeating the interpolation in every resource. Unlike variables, locals cannot be overridden with -var; they are not automatically exposed as outputs unless explicitly defined in an output block; and there is no ordering requirement that locals precede variable declarations.

  19. 19. A root configuration calls a module for provisioning a VPC, passing in a cidr_block variable and expecting a vpc_id back for use elsewhere in the root. Which two module features make this data flow possible?

    • A. Input variables defined in the module accept values from the caller, and output values defined in the module expose data back to the caller
    • B. Modules automatically share their entire state with the root module without any explicit inputs or outputs
    • C. Only the root module can define variables; child modules can only define outputs
    • D. Modules communicate exclusively through provider configuration blocks
    Show answer & explanation

    Answer: A
    A module receives configuration through its own input variable declarations and exposes computed data to callers through output values — this variable-in, output-out pattern is exactly how the root passes cidr_block in and receives vpc_id back. Modules do not implicitly share full state without explicit outputs, child modules can and do define their own variables, and this data flow has nothing to do with provider blocks.

  20. 20. A team wants to reuse a well-tested networking module published by a third party, pinning it to a specific version to avoid unexpected breaking changes. Which source configuration best supports this in a module block?

    • A. Referencing the module from a registry source with an explicit version constraint, e.g. version = "~> 2.0"
    • B. Copying the module's source files directly into every consuming configuration's directory
    • C. Referencing the module source with no version argument so it always tracks the newest release
    • D. Declaring the module as a provider block instead of a module block
    Show answer & explanation

    Answer: A
    Registry module sources support a version constraint argument, letting teams pin to a known-good version range and control upgrades deliberately. Copying files defeats the purpose of centralized reuse and updates; omitting a version constraint risks unexpected breaking changes on the next run; and modules and providers are distinct block types serving different purposes.

  21. 21. Within a root module, a child module block is written as `module "network" { source = "./modules/network" }` and the module internally creates an aws_vpc resource named "this". How would the root module reference an output value named vpc_id exposed by that module?

    • A. network.module.vpc_id
    • B. var.network.vpc_id
    • C. module.network.vpc_id
    • D. aws_vpc.this.vpc_id
    Show answer & explanation

    Answer: C
    Module outputs are referenced from the calling configuration as module.<module_name>.<output_name>, so module.network.vpc_id is correct. aws_vpc.this.vpc_id would only work inside the module itself, not from the root, since the root doesn't have direct access to the module's internal resources; the other two options use invalid reference syntax.

  22. 22. A large configuration repeats near-identical blocks for provisioning a web tier across three environments (dev, staging, prod), varying only instance sizes and counts. What is the primary architectural benefit of extracting this into a reusable module with input variables for size and count?

    • A. It centralizes the shared logic in one place so fixes and improvements propagate to every environment that calls the module
    • B. It removes the need to ever run terraform plan in any environment that uses the module
    • C. It guarantees that all three environments will always have identical instance counts
    • D. It automatically merges the three environments' state files into one
    Show answer & explanation

    Answer: A
    Modules encapsulate shared logic once, so a bug fix or improvement made in the module benefits every environment that calls it, rather than needing to be copy-pasted three times. Modules don't remove the need to plan/apply per environment, they don't force identical counts (that's the point of parameterizing with variables), and they don't merge separate state files together.

  23. 23. A nested child module internally calls another module two levels deep, and that innermost module declares a resource. From the root module's perspective, why can't the root directly reference that innermost resource by its resource address without going through outputs?

    • A. Each module has its own local resource namespace, and data only crosses a module boundary through explicitly declared outputs and inputs
    • B. Terraform limits module nesting to a single level, so this configuration would fail to load
    • C. Resources declared in nested modules are automatically renamed to include the root module's name
    • D. Only provider configurations, never resources, can exist inside nested modules
    Show answer & explanation

    Answer: A
    Module boundaries encapsulate their internal resource addresses; the only sanctioned way to pass data upward is through explicitly declared output values that a caller then references via module.<name>.<output>. Terraform supports multiple levels of module nesting (not just one), resources aren't auto-renamed to include the root's name, and resources absolutely can exist inside nested modules alongside provider configuration.

  24. 24. Two engineers run terraform apply against the same remote backend workspace at nearly the same time. What mechanism is designed to prevent both applies from corrupting the state file simultaneously?

    • A. State locking, which many remote backends support to serialize concurrent write operations
    • B. Terraform automatically merges concurrent state changes like a version control system merges text files
    • C. Local state files always prevent concurrent access even without a remote backend
    • D. The second terraform apply silently overwrites the first apply's state changes without warning
    Show answer & explanation

    Answer: A
    State locking is the mechanism supported by many remote backends to ensure only one operation can write to state at a time, preventing corruption from concurrent applies. Terraform does not perform automatic conflict-style merges of state, a locked second apply is blocked/errored rather than silently overwriting, and plain local state files provide much weaker (often no) protection against concurrent access compared to a locking remote backend.

  25. 25. An engineer manually deletes a cloud resource from the provider console that Terraform is still tracking in its state file. The next time terraform plan runs, what will Terraform most likely report?

    • A. Terraform will automatically update its state to remove the resource with no plan output at all
    • B. terraform plan will fail with an unrecoverable error and require deleting the entire state file
    • C. Terraform will ignore the discrepancy until the next terraform destroy is run
    • D. Terraform will detect drift and plan to recreate the resource, since state says it should exist but the real infrastructure does not
    Show answer & explanation

    Answer: D
    During refresh, Terraform detects that a resource present in state no longer exists in the real infrastructure (drift) and will typically plan to create it again to reconcile state with the desired configuration. It doesn't silently and automatically drop it from state without surfacing a plan, it does not require deleting the whole state file, and it does not simply ignore the discrepancy until a destroy.

  26. 26. A team stores terraform.tfstate as a local file inside their project's git repository. What is the most significant risk of this practice compared to using a remote backend?

    • A. State can easily fall out of sync between collaborators, and sensitive values in state may be exposed in version control history
    • B. Local state files cannot store resource attributes at all
    • C. Git repositories reject any file over 1 KB, so state files will not commit successfully
    • D. Local state automatically encrypts itself when committed to any git provider
    Show answer & explanation

    Answer: A
    Local state committed to git risks collaborators working from stale or conflicting copies and exposes potentially sensitive resource attributes (like passwords or keys stored in state) in version history — a key reason remote backends with locking and encryption-at-rest are recommended. Local state does store resource attributes (that's its purpose), git has no such 1 KB restriction, and state committed to git is not automatically encrypted.

  27. 27. A resource was created outside of Terraform (via the console) and now needs to be brought under Terraform management without destroying and recreating it. Which command is designed for this purpose?

    • A. terraform import
    • B. terraform taint
    • C. terraform refresh only, with no configuration written
    • D. terraform apply -destroy
    Show answer & explanation

    Answer: A
    terraform import associates an existing real-world resource with a resource address in Terraform state, without destroying or recreating it, so it can then be managed going forward. terraform taint instead marks an already-managed resource for forced recreation, refreshing without any matching configuration won't create the tracked mapping needed, and 'apply -destroy' would tear the resource down rather than adopt it.

  28. 28. A team splits a large monolithic configuration's state into multiple smaller state files organized by service boundary (networking, database, application). What is a key trade-off introduced by this split?

    • A. Cross-service references now require explicit data sharing (such as remote state data sources or outputs), since each state file only knows about its own resources
    • B. All state files must now be applied in a single terraform apply command simultaneously
    • C. Splitting state eliminates the possibility of ever needing state locking
    • D. Terraform automatically keeps all split state files in sync with no additional configuration
    Show answer & explanation

    Answer: A
    When state is split by service, each state file only tracks its own resources, so referencing another service's resource (e.g., the networking VPC ID from the database configuration) requires an explicit mechanism like a terraform_remote_state data source or another shared data-passing approach. Split states are still applied independently (not forced into one combined apply), locking remains relevant to each backend, and Terraform does not auto-synchronize independent state files.

  29. 29. A provider's resource attribute value stored in state does not match the real infrastructure's current value because someone modified the resource out-of-band. Which core Terraform operation, run as part of plan, is responsible for detecting this kind of discrepancy before proposing changes?

    • A. The refresh step, which queries the current state of real infrastructure and reconciles it against the recorded state
    • B. terraform fmt, which reformats configuration files
    • C. terraform validate, which only checks configuration syntax
    • D. terraform init, which downloads provider plugins
    Show answer & explanation

    Answer: A
    As part of generating a plan, Terraform performs a refresh that queries real infrastructure and reconciles any drift against the recorded state before determining what changes are needed. terraform fmt only reformats code style, terraform validate checks syntax/internal consistency without querying real infrastructure, and terraform init just prepares the working directory and providers.

  30. 30. An operator wants to permanently remove a resource from Terraform's management without destroying the underlying real-world infrastructure. Which action accomplishes this?

    • A. Removing the resource from state (e.g., via terraform state rm) while leaving the configuration or real resource alone as needed
    • B. Deleting the resource block from configuration is always sufficient with no other steps and never triggers a destroy
    • C. Renaming the resource's local name in configuration accomplishes the same outcome automatically
    • D. Running terraform destroy, which only removes the state entry and never touches real infrastructure
    Show answer & explanation

    Answer: A
    terraform state rm removes a resource from Terraform's state tracking without issuing any API calls against the real infrastructure, effectively 'forgetting' it while leaving it running. terraform destroy actively deletes the real infrastructure (not just the state entry); simply deleting the resource block from configuration will cause the next apply to plan a destroy of the real resource, not just forget it; and renaming a resource's local name without a moved block will make Terraform plan to destroy the old address and create a new one, not simply detach it.

  31. 31. A team wants to run custom validation scripts, generate documentation, or trigger notifications as part of their infrastructure lifecycle, but outside the scope of what terraform plan/apply directly does. Which category of usage does this best describe?

    • A. Using Terraform outside of its core workflow, such as via external tooling, wrapper scripts, or provisioners integrated around the standard commands
    • B. This is only possible by modifying the Terraform binary's source code directly
    • C. This requires abandoning Terraform entirely in favor of a different tool
    • D. terraform plan natively performs documentation generation and notification sending with no extra tooling
    Show answer & explanation

    Answer: A
    Extending Terraform's lifecycle with custom validation, documentation generation, or notifications via wrapper scripts, CI integration, or provisioners is a standard example of using Terraform outside its core init/plan/apply workflow. None of this requires modifying Terraform's own source code or abandoning it, and plan/apply do not natively perform documentation generation or send notifications on their own.

  32. 32. A provisioner block is added to a resource to run a remote-exec script that installs an application after the instance is created. What is a commonly cited caveat about relying heavily on provisioners for this purpose?

    • A. Provisioners are considered a last resort because they can introduce non-idempotent, harder-to-track behavior compared to native provider features or dedicated configuration management tools
    • B. Provisioners can only be attached to data sources, never to resources
    • C. Provisioners always run before terraform plan and never during apply
    • D. Using any provisioner permanently disables state locking for that resource
    Show answer & explanation

    Answer: A
    Terraform's own guidance treats provisioners as a last resort because their imperative script execution can behave inconsistently across runs and is harder for Terraform to model/track than declarative resource attributes or purpose-built configuration management tools. Provisioners attach to resources (not data sources), they execute during apply/destroy (not before plan), and they have no relationship to disabling state locking.

  33. 33. A pipeline wants to check that all committed .tf files are syntactically valid and consistently formatted before merging, without actually connecting to any cloud provider. Which combination of commands best supports this outside the normal plan/apply flow?

    • A. terraform fmt -check and terraform validate
    • B. terraform apply -auto-approve and terraform destroy
    • C. terraform import and terraform state rm
    • D. terraform workspace new and terraform workspace select
    Show answer & explanation

    Answer: A
    terraform fmt -check verifies formatting consistency and terraform validate checks configuration syntax and internal consistency, both without requiring provider credentials or making real infrastructure calls, making them ideal for pre-merge CI gating. apply/destroy would actually provision/tear down infrastructure, import/state rm manipulate state tracking of real resources, and workspace commands manage workspace context rather than validating syntax or formatting.

  34. 34. A team wants a shared, remote location to run terraform plan and apply, with built-in state storage, access controls, and a history of runs visible to the whole team, rather than everyone running Terraform CLI locally against a self-managed backend. Which product area does this describe?

    • A. HCP Terraform (Terraform Cloud), which provides remote runs, state management, and collaboration features as a managed service
    • B. terraform console, a local-only command for evaluating expressions interactively
    • C. The terraform fmt command, which only reformats configuration files
    • D. A provider plugin, which only implements resource and data source logic for a specific platform
    Show answer & explanation

    Answer: A
    HCP Terraform (Terraform Cloud) is HashiCorp's managed offering providing remote plan/apply runs, centralized state storage, access controls, and run history/collaboration for teams — exactly the shared workflow described. terraform console is a local interactive expression evaluator, terraform fmt only reformats files, and a provider plugin implements resource/data source logic rather than offering collaborative remote runs.

  35. 35. An organization uses HCP Terraform workspaces to separate configuration and state for dev, staging, and prod environments, each with its own variable sets and run history. What is the primary organizational benefit of using separate workspaces here rather than one shared workspace for all three environments?

    • A. Workspaces remove the need to ever define environment-specific variables
    • B. Each environment's state, variables, and run history stay isolated, reducing the risk that a change intended for one environment accidentally affects another
    • C. Separate workspaces automatically synchronize variable values across all environments
    • D. Only one workspace total is allowed per HCP Terraform organization
    Show answer & explanation

    Answer: B
    Separate workspaces isolate state, variable sets, and run history per environment, which limits blast radius so a dev change can't accidentally apply against prod's state. Workspaces don't auto-sync variables across environments (isolation is the point), organizations can have many workspaces, and environment-specific variables are still very much needed — workspaces are how you organize them, not eliminate them.

  36. 36. A company wants multiple engineers to collaborate on the same set of Terraform configurations, with runs automatically triggered on VCS commits and clear visibility into who approved which apply. Which HCP Terraform capability area most directly supports this requirement?

    • A. VCS-driven workflows combined with team-based access controls and run approval history
    • B. Only running terraform apply -auto-approve locally on each engineer's laptop
    • C. Manually emailing plan output to teammates for review before every apply
    • D. Disabling state locking so multiple people can apply concurrently without waiting
    Show answer & explanation

    Answer: A
    HCP Terraform's VCS integration triggers runs from commits, and its team/permissions model plus run history gives visibility into who approved or applied changes — directly matching the described collaboration need. Running apply locally with auto-approve bypasses review entirely, manually emailing plan output is an ad hoc workaround rather than a built-in collaboration feature, and disabling locking would increase risk of state corruption rather than support safe collaboration.

  37. 37. A workspace in HCP Terraform is configured with remote execution mode, meaning plan and apply operations run on HCP Terraform's infrastructure rather than a user's local machine. What is one advantage of this remote execution model for a team?

    • A. Runs execute in a consistent, centrally managed environment with consistent provider/plugin versions and don't depend on any individual engineer's local machine setup
    • B. Remote execution mode removes the need for any provider credentials to be configured anywhere
    • C. Remote execution guarantees that plans never show any changes
    • D. Remote execution mode is only available for the terraform destroy command
    Show answer & explanation

    Answer: A
    Remote execution runs plan/apply in a consistent, centrally managed environment, avoiding 'works on my machine' drift from differing local CLI/provider versions across engineers. Provider credentials must still be configured (just centrally, e.g., as workspace variables) rather than eliminated, remote execution doesn't guarantee empty plans, and it applies to the standard plan/apply/destroy operations, not just destroy.

  38. 38. Which of the following best describes what HCP Terraform's Sentinel or OPA-based policy checks are typically used for in a workspace's run pipeline?

    • A. Replacing the need for a provider block in the configuration
    • B. Automatically writing the Terraform configuration files for the user
    • C. Formatting HCL code according to canonical style
    • D. Enforcing organizational rules (such as required tags, allowed instance types, or cost limits) against a plan before it can be applied
    Show answer & explanation

    Answer: D
    Policy-as-code checks (like Sentinel or OPA) evaluate a proposed plan against organizational guardrails — tagging standards, allowed resource types, cost thresholds — and can block non-compliant applies, which is their core purpose in a run pipeline. They don't generate configuration files, don't substitute for provider blocks, and are unrelated to code formatting (that's terraform fmt).

  39. 39. A newcomer to Terraform asks why 'basic terminal skills and an understanding of on-premises and cloud architecture' are recommended before attempting to learn Terraform in a production context. Which best explains this recommendation?

    • A. Terraform is operated primarily via CLI commands and manages real infrastructure resources, so comfort with a terminal and infrastructure concepts helps in understanding what configurations actually provision
    • B. Terraform cannot be installed on any operating system that includes a graphical user interface
    • C. HashiCorp requires a separate terminal-usage certification before anyone may install Terraform
    • D. Infrastructure architecture knowledge is only relevant to Terraform's HCP Terraform product, not the open-source CLI
    Show answer & explanation

    Answer: A
    Since Terraform is primarily a CLI-driven tool that provisions real infrastructure, basic terminal fluency and infrastructure/architecture familiarity help practitioners understand and safely use the commands and the resources they create. Terraform installs fine on GUI-based operating systems, there is no separate mandatory terminal certification, and infrastructure knowledge is relevant to core Terraform usage broadly, not just HCP Terraform.

  40. 40. A candidate is scheduling their Terraform Associate exam and wants to know roughly how long they should budget for the actual online proctored session. Which duration should they plan for?

    • A. About 1 hour (60 minutes)
    • B. About 4 hours
    • C. About 15 minutes
    • D. About 8 hours across two sessions
    Show answer & explanation

    Answer: A
    The exam is a multiple choice exam that lasts 1 hour (60 minutes), so candidates should budget roughly that amount of time for the proctored session itself. It is not a multi-hour exam, nowhere near as short as 15 minutes, and is not split into an 8-hour two-session format.

  41. 41. A candidate wants to know how many separate objective domains the Terraform Associate (004) exam measures knowledge across, so they can plan their study checklist. What is the correct count?

    • A. Eight objective domains
    • B. Three objective domains
    • C. Twelve objective domains
    • D. Five objective domains
    Show answer & explanation

    Answer: A
    The exam measures knowledge across eight objective domains, spanning topics from IaC concepts through HCP Terraform. Three would undercount significantly (that number actually corresponds to the exam's question format types, not domain count), twelve overcounts the objectives, and five is also an undercount relative to the documented eight domains.

  42. 42. A candidate is reviewing the format of the Terraform Associate exam and wants to know what kinds of questions to expect on exam day. Which set of question types matches the official format?

    • A. True or false, multiple choice, and multiple answer questions
    • B. Only essay-style, free-response questions
    • C. Only fill-in-the-blank coding exercises with no answer choices
    • D. Only matching-pairs style questions
    Show answer & explanation

    Answer: A
    The exam uses three question formats: true or false, multiple choice, and multiple answer question types, all objective and machine-scored. It is not composed of essay/free-response items, does not use open fill-in-the-blank coding exercises, and does not use a matching-pairs format.

  43. 43. A candidate passes the Terraform Associate exam today and wants to know how long the resulting certification credential remains valid before recertification is required.

    • A. 2 years
    • B. 1 year
    • C. 5 years
    • D. The credential never expires
    Show answer & explanation

    Answer: A
    The Terraform Associate credential is valid for 2 years from the date it is earned, after which recertification is required to maintain it. It is not valid for only 1 year, does not extend to 5 years, and is not a permanently non-expiring credential.

  44. 44. A candidate fails the Terraform Associate exam on their first attempt and asks whether a free retake is included in the price they already paid. Based on the official policy, what should they be told?

    • A. No, a free retake is not included in the exam price, so a retake would require paying again
    • B. Yes, every candidate automatically receives one free retake within 24 hours
    • C. Yes, but only if they fail by fewer than five percentage points
    • D. Retakes are entirely prohibited and the credential can never be attempted again
    Show answer & explanation

    Answer: A
    A free retake is not included in the exam price, meaning candidates who wish to retake the exam after failing generally need to pay again. There is no automatic free retake window, no scoring-margin exception for a free retake, and retakes are not categorically prohibited — the point is simply that they aren't bundled free with the original fee.

  45. 45. A study guide for this exam version notes that scenario questions may assume behavior consistent with a specific Terraform release line. Which version does this exam version test on?

    • A. Terraform 1.12
    • B. Terraform 0.11
    • C. Terraform 2.0
    • D. Terraform 1.0 exactly, with no later point releases
    Show answer & explanation

    Answer: A
    This version of the exam tests on Terraform 1.12, so candidates should be comfortable with behavior and syntax current as of that release line. Terraform 0.11 predates the modern HCL2 syntax and is long outdated, there is no Terraform 2.0 release, and the exam is not scoped narrowly to only the original 1.0 release with no later point releases.

  46. 46. A candidate asks whether the Terraform Associate exam publishes an official percentage weighting for each of its eight objective domains, similar to how some other certification exams list exact percentages per domain. Based on the official exam guidance, what is accurate?

    • A. The exam does not publish per-objective percentage weightings, so candidates should prepare across all eight domains rather than optimizing study time by a published percentage split
    • B. Each of the eight domains is weighted at exactly 12.5 percent, published officially by HashiCorp
    • C. The state management domain alone makes up 50 percent of the exam by official published weighting
    • D. Only two of the eight domains are actually tested, despite all eight being listed
    Show answer & explanation

    Answer: A
    HashiCorp's official guidance for this exam states that per-objective percentage weightings are not published, so candidates cannot rely on an official breakdown to prioritize study time by percentage. There is no officially published even 12.5 percent split, no official statement that state management alone is 50 percent, and all eight listed domains are in scope for testing, not just two.

  47. 47. A configuration is applied and later a resource is changed manually outside the tool. What does the next plan show?

    • A. A difference between the recorded state and reality, proposing changes to bring the resource back to the configured state
    • B. No changes, since state is the authoritative record
    • C. An error preventing any further operations permanently
    • D. Automatic adoption of the manual change into the configuration
    Show answer & explanation

    Answer: A
    Refresh compares recorded state against the real infrastructure, so drift appears in the plan as changes required to reconcile them. The configuration is the source of truth rather than the live resource, which is why manual changes are reverted rather than adopted, and this is the mechanism that makes out-of-band changes visible.

  48. 48. A team stores state in a remote backend rather than locally. What two problems does this address?

    • A. Sharing state across the team and preventing concurrent operations through locking, alongside keeping sensitive state values off individual machines
    • B. Reducing the time each apply takes to complete
    • C. Removing the need to write a configuration
    • D. Eliminating provider authentication requirements
    Show answer & explanation

    Answer: A
    Local state cannot be shared safely and two simultaneous applies against the same infrastructure produce corruption, which locking prevents. State also contains resource attributes that can include sensitive values, so a remote backend with access control and encryption addresses a real exposure that a file in a working directory does not.

  49. 49. An existing resource created outside the tool must be brought under management. What is required?

    • A. Deleting and recreating it through the tool
    • B. Renaming the resource to match a naming convention
    • C. Nothing, since resources are adopted automatically on the next apply
    • D. Importing it so state records the existing object, along with a configuration block matching its actual settings
    Show answer & explanation

    Answer: D
    Import populates state but does not generate configuration, so a mismatched or absent configuration block causes the next plan to propose changing or destroying the imported resource. Writing the configuration to match reality before applying is the step most often skipped, with destructive consequences.

  50. 50. A plan proposes to destroy and recreate a resource rather than update it in place. What determines this?

    • A. Whether the changed attribute can be modified on the live resource, since attributes that cannot be updated force replacement
    • B. The alphabetical position of the resource in the configuration
    • C. The size of the state file
    • D. Whether the backend is local or remote
    Show answer & explanation

    Answer: A
    Some attributes are immutable in the underlying platform, so changing them requires replacement and the plan marks the resource accordingly. Reading the plan for forced replacements is essential before applying, since replacement of a stateful resource destroys its data and a lifecycle rule creating the replacement before destroying the original can mitigate downtime.

  51. 51. A configuration must create a variable number of near-identical resources from a list of names. Which construct is generally preferred and why?

    • A. for_each keyed by a set or map, because resources are addressed by key rather than by index so removing one element does not shift the others
    • B. count with the list's length, because index-based addressing is more stable
    • C. Copying the resource block once per name
    • D. A provisioner running a loop inside the resource
    Show answer & explanation

    Answer: A
    With count, deleting a middle element renumbers every subsequent index, so the plan proposes destroying and recreating resources that did not change. Keys under for_each are stable against list reordering, which is why it is preferred whenever the collection may change.

  52. 52. A module is reused across environments. How are environment-specific values supplied?

    • A. Through input variables passed by the calling configuration, with outputs exposing values other configurations need
    • B. By editing the module's source each time it is used
    • C. By hardcoding values and maintaining a copy per environment
    • D. By setting operating system environment variables inside the module
    Show answer & explanation

    Answer: A
    Variables and outputs form the module's interface, which is what makes it reusable without modification and lets its internals change without affecting callers. Copying a module per environment removes the benefit entirely, since a fix must then be applied to every copy and the copies drift apart.

  53. 53. The initialization step is run in a new working directory. What does it do?

    • A. Downloads required providers and modules, configures the backend and prepares the working directory for planning and applying
    • B. Validates only the configuration syntax with no other effect
    • C. Creates the infrastructure described in the configuration
    • D. Destroys any existing infrastructure
    Show answer & explanation

    Answer: A
    Initialization is the prerequisite that resolves dependencies and connects to the backend, and it must be re-run when providers, modules or backend configuration change. Validation is a separate command checking configuration correctness without contacting providers or the backend.

  54. 54. A plan is saved to a file and later applied. What guarantee does this provide?

    • A. The apply executes exactly the actions the saved plan described, rather than recomputing them against possibly changed conditions
    • B. The apply cannot fail under any circumstances
    • C. The plan file can be applied to a different state
    • D. No provider credentials are needed at apply time
    Show answer & explanation

    Answer: A
    Separating the plan from the apply is what makes review meaningful, since applying a saved plan executes precisely what was reviewed rather than whatever a fresh plan would compute. The apply can still fail if the underlying platform rejects an action, and saved plans can contain sensitive values so they are handled accordingly.

  55. 55. A resource must be created only after another resource exists, but no attribute reference links them. How is the ordering expressed?

    • A. An explicit dependency declaration, since the dependency graph is otherwise built from attribute references between resources
    • B. Placing the resource blocks in the desired order within the file
    • C. Naming the resources alphabetically in sequence
    • D. Splitting the resources into separate files
    Show answer & explanation

    Answer: A
    Ordering is derived from the graph rather than from file layout, so resources with no reference between them may be created in parallel in any order. An explicit dependency is the escape hatch for relationships the configuration does not express through references, such as an IAM policy that must exist before an action is attempted.

  56. 56. A value must be looked up from an existing resource that the configuration does not manage. What construct provides this?

    • A. A data source, which reads information without creating or managing the underlying object
    • B. A resource block, which would create a duplicate object
    • C. An output block, which exposes values to callers
    • D. A variable block, which accepts input
    Show answer & explanation

    Answer: A
    Data sources read without owning, which is exactly what is needed for objects another team or process manages. Declaring the same object as a managed resource would attempt to create a second one or, after import, place it under this configuration's control including its destruction.

  57. 57. A variable is marked as sensitive. What does this affect?

    • A. Display of the value in plan and apply output, while the value is still recorded in state and must be protected there
    • B. Encryption of the value within the state file automatically
    • C. Whether the value can be passed to a module
    • D. Whether the value is stored in the configuration file
    Show answer & explanation

    Answer: A
    The sensitive flag suppresses console display and prevents accidental exposure in logs, but it does not encrypt state, where the value is still written. Protecting state through backend encryption and access control is therefore necessary regardless of how variables are marked.

  58. 58. Workspaces are used within a single configuration. What do they provide?

    • A. Separate state instances for the same configuration, suitable for lightweight variation but not for strongly isolated environments
    • B. Complete isolation including separate credentials and backends
    • C. A separate configuration per environment
    • D. Automatic promotion of changes between environments
    Show answer & explanation

    Answer: A
    Workspaces separate state while sharing the configuration and backend, so an operator in the wrong workspace can act on the wrong environment. Strong separation between production and non-production is usually achieved with separate configurations, backends and credentials rather than with workspaces alone.

  59. 59. A team must review infrastructure changes before they are applied. What makes the plan output suitable for that review?

    • A. It enumerates each resource to be created, updated, replaced or destroyed with the specific attribute changes, so destructive actions are visible before execution
    • B. It guarantees the changes will succeed
    • C. It applies non-destructive changes automatically during review
    • D. It hides replacements to keep output concise
    Show answer & explanation

    Answer: A
    The value of the plan in review is that destroy and replace actions are stated explicitly rather than discovered afterward, which is why automated pipelines commonly require approval when a plan contains them. The plan describes intent rather than guaranteeing success, since the platform can still reject an action at apply time.

  60. 60. A resource must be replaced deliberately without changing its configuration. What is the appropriate approach?

    • A. Requesting replacement of that specific resource address in the plan, so only it is recreated
    • B. Deleting the entire state file and reapplying
    • C. Manually deleting the resource in the platform console
    • D. Renaming the resource block
    Show answer & explanation

    Answer: A
    Targeted replacement rebuilds one resource while leaving the rest untouched, which suits a resource in a bad runtime state. Deleting state orphans every managed resource, and renaming a block causes the tool to plan destroying the old address and creating a new one, which is replacement with additional confusion.

  61. 61. A resource must be removed from management without being destroyed. What accomplishes this?

    • A. Removing it from state so the tool forgets it, leaving the real object in place unmanaged
    • B. Deleting the resource block and applying, which destroys it
    • C. Setting the resource's count to zero, which destroys it
    • D. Renaming the resource block
    Show answer & explanation

    Answer: A
    State removal severs the association without touching the infrastructure, which is the operation needed when handing a resource to another team or configuration. Removing the block or zeroing count both instruct the tool to destroy the object, which is the opposite outcome.

  62. 62. Infrastructure as code is adopted in place of console-driven changes. What benefit is most fundamental?

    • A. The configuration becomes a reviewable, versioned record so environments can be reproduced and changes carry history and approval
    • B. Infrastructure becomes free to operate
    • C. Changes can no longer fail
    • D. Credentials are no longer required
    Show answer & explanation

    Answer: A
    Codifying infrastructure brings review, history and reproducibility to changes that were previously made by hand with no record of who did what or why. Drift remains possible where manual changes are still made, which is why detecting and reconciling it is part of the practice rather than an assumed outcome.

  63. 63. A tool is described as declarative rather than imperative for infrastructure management. What follows from this?

    • A. The configuration describes the desired end state and the tool determines the actions, so applying the same configuration repeatedly converges rather than duplicating work
    • B. Each action must be scripted in the order it should execute
    • C. The configuration cannot express dependencies between resources
    • D. The tool cannot detect existing infrastructure
    Show answer & explanation

    Answer: A
    Idempotence is the practical consequence, since a second apply against an unchanged configuration proposes no actions rather than creating duplicates. Dependencies are still expressed, through references that build the graph, and the tool determines execution order from that graph rather than from written sequence.

  64. 64. A managed service offers remote execution of runs with policy enforcement before apply. What capability does the policy layer add?

    • A. Automated evaluation of a proposed plan against organizational rules, blocking or requiring override for changes that violate them
    • B. Faster provider downloads during initialization
    • C. Automatic generation of the configuration from existing infrastructure
    • D. Elimination of the need for state storage
    Show answer & explanation

    Answer: A
    Policy evaluation inspects the plan before apply, so a rule such as prohibiting publicly accessible storage is enforced automatically rather than depending on a reviewer noticing. Advisory, soft-mandatory and hard-mandatory enforcement levels let an organization distinguish a warning from a rule that cannot be overridden.

  65. 65. Remote runs are used so applies do not execute from individual workstations. What advantage does this provide beyond convenience?

    • A. Provider versions become irrelevant
    • B. State is no longer required
    • C. Credentials are held centrally rather than on developer machines, and every run produces a consistent audited record
    • D. Configuration no longer needs to be written
    Show answer & explanation

    Answer: C
    Centralizing execution removes long-lived infrastructure credentials from laptops, which is where they are most exposed, and produces a uniform record of who applied what and when. It also eliminates the class of failures caused by differing local tool and provider versions between team members.

2026 statistics

Key facts: Terraform Associate exam

1h
Time limit
$70.5
Exam fee
Review the key concepts
Use the compact reference to prepare for your next practice session
Open cheat sheet →

Every free resource for this exam

Get a free Terraform Associate study plan

A week-by-week plan plus new practice questions, straight to your inbox.

Official sources

Primary documents used to verify the exam details shown on this page.

Last verified against the official exam content outline:

Frequently asked questions

What version of Terraform does the Terraform Associate (004) exam cover, and what does it test?

The 004 exam tests on Terraform 1.12. It measures your knowledge across eight objective domains: Infrastructure as Code (IaC) concepts, the purpose of Terraform versus other IaC tools, Terraform basics, using Terraform outside of the core workflow, interacting with modules, the core Terraform workflow, implementing and maintaining state, and reading/generating/modifying configuration. Content spans areas like state management (local and remote backends, state locking, and drift management) and HCP Terraform (cloud-based infrastructure creation, collaboration features, and workspace organization). Note that the exam does not publish per-objective percentage weightings, so you should aim for balanced coverage rather than betting on any single domain.

How long is the exam, what does it cost, and what question formats should I expect?

The exam is an online proctored, multiple choice exam that lasts 60 minutes and costs $70.50 USD (plus locally applicable taxes and fees). A free retake is not included in that price, so treat your first attempt as the one that counts and budget for a second sitting only if needed. You'll encounter three question formats: true or false, multiple choice, and multiple answer questions. Because multiple-answer questions require selecting every correct option, read those carefully and note how many answers each question asks for. With roughly 60 minutes for the whole exam, pacing yourself to avoid getting stuck on any single item is worthwhile.

Who is this certification for, and what background do I need before attempting it?

The Terraform Associate (004) is aimed at Cloud Engineers, DevOps practitioners, and others who use Terraform in production. The recommended prerequisites are basic terminal skills and a basic understanding of on-premises and cloud architecture; professional experience is recommended but not required. This means motivated newcomers can pass without a formal job title in the field, but you should be comfortable running commands in a terminal and understand core cloud concepts before you begin. Hands-on practice writing and applying configurations will help far more than reading alone, given the workflow- and configuration-focused objectives.

How long is the credential valid, and what should I plan for after passing?

The Terraform Associate credential is valid for 2 years. After that window, you'll need to recertify to keep your credential current — so it's worth noting your pass date and setting a reminder roughly a couple of months before expiry to review and re-sit. Because the exam version tracks a specific Terraform release (currently 1.12), the recertification exam may test on a newer version and updated objectives by the time you renew, so plan to refresh your knowledge of the latest features rather than relying solely on what you learned the first time.