HashiCorp Terraform Associate (HashiCorp Certified: Terraform Associate) Practice Test 52

Question 510

A platform standardization effort has a concrete implementation goal: determine a safe sequence for creating objects with references between them. What is the most appropriate Terraform mechanism?

  1. Desired-state reconciliation
  2. A resource graph
  3. Declarative resource configuration
  4. Repeatable environment definition

Explanation

Correct Answer

B:

Terraform derives dependency edges from references, using the graph to order dependent changes and permit safe parallel operations; this directly meets the requirement to determine a safe sequence for creating objects with references between them. By comparison, declarative resource configuration is intended to describe the desired infrastructure state instead of scripting every API step, which is a different task from determine a safe sequence for creating objects with references between them.

Incorrect Answers

A:

Planning compares configuration with state and refreshed remote data to propose actions that reconcile differences; this mechanism is useful when the job is to identify changes between the declared configuration and managed infrastructure, whereas the current scenario requires the engineer to determine a safe sequence for creating objects with references between them. These operations have different effects in the stated Terraform workflow.

C:

Terraform interprets resource declarations, constructs a dependency graph, and asks providers to reconcile real objects with that desired state; this mechanism is useful when the job is to describe the desired infrastructure state instead of scripting every API step, whereas the current scenario requires the engineer to determine a safe sequence for creating objects with references between them. These operations have different effects in the stated Terraform workflow.

D:

IaC configuration provides repeatable definitions; variables and isolated state allow environments to differ without independently hand-building each object; this mechanism is useful when the job is to recreate the same logical infrastructure design across test and production, whereas the current scenario requires the engineer to determine a safe sequence for creating objects with references between them. These operations have different effects in the stated Terraform workflow.

Question 511

During a design review, the requirement is to select a specific VCS module release without using a registry version argument. Which option should the engineer select?

  1. Reviewing module upgrade changes
  2. Init -upgrade for registry modules
  3. Init after module version change
  4. A Git tag pin for a module

Explanation

Correct Answer

D:

A Git module's ?ref= tag or commit selects a repository revision instead of a registry module version constraint; this directly meets the requirement to select a specific VCS module release without using a registry version argument. By comparison, init -upgrade for registry modules is intended to consider newer published module releases already allowed by a version constraint, which is a different task from select a specific VCS module release without using a registry version argument.

Incorrect Answers

A:

A module upgrade can change resource definitions and outputs, so the consumer should inspect the new source and resulting Terraform plan; this concerns the task to control behavioral changes after moving to a new module release, not the current need to select a specific VCS module release without using a registry version argument. A A Git tag pin for a module approach is appropriate here; the substituted Reviewing module upgrade changes option does not supply the specified Terraform capability.

B:

The upgrade mode reselects module versions subject to constraints instead of automatically keeping the previously installed copy; this mechanism is useful when the job is to consider newer published module releases already allowed by a version constraint, whereas the current scenario requires the engineer to select a specific VCS module release without using a registry version argument. These operations have different effects in the stated Terraform workflow.

C:

Changing a module source or version constraint requires reinitializing to resolve the updated selection; this mechanism is useful when the job is to install a newly allowed child module release after editing its version requirement, whereas the current scenario requires the engineer to select a specific VCS module release without using a registry version argument. These operations have different effects in the stated Terraform workflow.

Question 512

A diagnostic incident during Terraform execution needs to take ownership of an existing object rather than duplicating it. Which feature or operation is the most direct match?

  1. A matching resource declaration
  2. terraform plan -generate-config-out
  3. Importing without creating new infrastructure
  4. An import configuration review

Explanation

Correct Answer

C:

The import workflow adds an existing remote object to state and can manage it through later plans instead of creating a replacement automatically; this directly meets the requirement to take ownership of an existing object rather than duplicating it. By comparison, a matching resource declaration is intended to avoid unintended changes immediately after importing a remote object, which is a different task from take ownership of an existing object rather than duplicating it.

Incorrect Answers

A:

Imported infrastructure should have a corresponding resource block with configuration matching the desired attributes so the next plan is safe; this mechanism is useful when the job is to avoid unintended changes immediately after importing a remote object, whereas the current scenario requires the engineer to take ownership of an existing object rather than duplicating it. These operations have different effects in the stated Terraform workflow.

B:

The experimental config-generation flag can write suggested resource declarations for review and correction before apply; this mechanism is useful when the job is to produce draft HCL for resources named in import blocks without matching configuration, whereas the current scenario requires the engineer to take ownership of an existing object rather than duplicating it. These operations have different effects in the stated Terraform workflow.

D:

Generated resource declarations are a starting point and can include computed or unsuitable attributes requiring manual cleanup; this mechanism is useful when the job is to correct provider-generated HCL rather than trusting every inferred argument, whereas the current scenario requires the engineer to take ownership of an existing object rather than duplicating it. These operations have different effects in the stated Terraform workflow.

Question 513

A team consuming shared Terraform modules has a concrete implementation goal: fetch module code directly from a remote Git repository. What is the most appropriate Terraform mechanism?

  1. Registry module documentation
  2. A private registry module source
  3. A Git HTTPS module source
  4. terraform get

Explanation

Correct Answer

C:

A git::https:// source can retrieve a Terraform module from version control rather than from the module registry; this directly meets the requirement to fetch module code directly from a remote Git repository. By comparison, terraform get is intended to retrieve child modules without running the complete backend and provider setup steps, which is a different task from fetch module code directly from a remote Git repository.

Incorrect Answers

A:

Published module documentation and metadata describe the module interface and help consumers understand required arguments; this mechanism is useful when the job is to determine a module's declared inputs, outputs, providers and usage examples, whereas the current scenario requires the engineer to fetch module code directly from a remote Git repository. These operations have different effects in the stated Terraform workflow.

B:

HCP Terraform's private registry can distribute approved modules with access control and supported version metadata; this mechanism is useful when the job is to reuse an internally published module available to authorized organization members, whereas the current scenario requires the engineer to fetch module code directly from a remote Git repository. These operations have different effects in the stated Terraform workflow.

D:

The terraform get command updates downloaded module sources only; routine workflows generally prefer terraform init; this mechanism is useful when the job is to retrieve child modules without running the complete backend and provider setup steps, whereas the current scenario requires the engineer to fetch module code directly from a remote Git repository. These operations have different effects in the stated Terraform workflow.

Question 514

A Terraform state maintenance procedure needs to avoid multiple infrastructure applies targeting the same shared HCP workspace state. Which feature or operation is the most direct match?

  1. Lock ownership verification
  2. A lock identifier
  3. State consistency during CI
  4. HCP Terraform run serialization

Explanation

Correct Answer

D:

HCP Terraform coordinates workspace runs and state handling, reducing conflicts among collaborating operators; this directly meets the requirement to avoid multiple infrastructure applies targeting the same shared HCP workspace state. By comparison, state consistency during CI is intended to keep two pipelines from changing the same infrastructure state simultaneously, which is a different task from avoid multiple infrastructure applies targeting the same shared HCP workspace state.

Incorrect Answers

A:

A lock may belong to another active run, so check its identity and run status rather than immediately forcing removal; this mechanism is useful when the job is to confirm that a held lock is stale before attempting manual removal, whereas the current scenario requires the engineer to avoid multiple infrastructure applies targeting the same shared HCP workspace state. These operations have different effects in the stated Terraform workflow.

B:

Terraform uses lock information to distinguish a specific operation's lock from unrelated lock holders; this mechanism is useful when the job is to ensure a force-unlock targets the correct held state lock, whereas the current scenario requires the engineer to avoid multiple infrastructure applies targeting the same shared HCP workspace state. These operations have different effects in the stated Terraform workflow.

C:

A state backend with locking helps serialize competing changes, complemented by pipeline approval and run coordination; this mechanism is useful when the job is to keep two pipelines from changing the same infrastructure state simultaneously, whereas the current scenario requires the engineer to avoid multiple infrastructure applies targeting the same shared HCP workspace state. These operations have different effects in the stated Terraform workflow.

Question 515

The team evaluates “Module composition” for a requirement to combine small modules into a root configuration without producing one giant module. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. Parent configurations can pass one child module's outputs into another child's inputs to compose larger infrastructure systems.
  2. The count meta-argument creates numerically indexed module instances such as module.worker[0].
  3. Two module blocks that use the same source create separate module instances and separate resource addresses.
  4. All Terraform configuration files in a module directory are combined as one module; filenames do not define separate execution units.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to combine small modules into a root configuration without producing one giant module, so it produces the behavior described. In contrast, a module with count serves a different goal: instantiate a fixed number of child module copies, not combine small modules into a root configuration without producing one giant module.

Incorrect Answers

B:

The description applies to a module with count when an engineer needs to instantiate a fixed number of child module copies; the named module composition instead handles the requirement to combine small modules into a root configuration without producing one giant module, so this behavior does not describe Module composition in the situation named.

C:

The description applies to multiple calls to one module when an engineer needs to deploy two independently managed stacks from the same module definition; the named module composition instead handles the requirement to combine small modules into a root configuration without producing one giant module, so this behavior does not describe Module composition in the situation named.

D:

The description applies to a module root directory when an engineer needs to understand which source files Terraform loads as one module; the named module composition instead handles the requirement to combine small modules into a root configuration without producing one giant module, so this behavior does not describe Module composition in the situation named.

Question 516

During a design review, the requirement is to install all referenced remote child modules before planning. Which option should the engineer select?

  1. The double-slash source subdirectory
  2. A relative local module source
  3. A Git ref query parameter
  4. terraform init for modules
  5. A public registry module source

Explanation

Correct Answer

D:

Initialization retrieves module sources and populates .terraform/modules while preparing other required dependencies; this directly meets the requirement to install all referenced remote child modules before planning. By comparison, a relative local module source is intended to reuse a neighboring module directory in the same repository, which is a different task from install all referenced remote child modules before planning.

Incorrect Answers

A:

Module source syntax places //subdir after the package address to select the intended directory within the downloaded package; this mechanism is useful when the job is to use a nested module stored below a repository's root directory, whereas the current scenario requires the engineer to install all referenced remote child modules before planning. These operations have different effects in the stated Terraform workflow.

B:

A module source such as ./modules/network points to a local directory and requires no registry download or semantic version selection; this mechanism is useful when the job is to reuse a neighboring module directory in the same repository, whereas the current scenario requires the engineer to install all referenced remote child modules before planning. These operations have different effects in the stated Terraform workflow.

C:

A source address ending in ?ref=... selects a Git revision; it does not use the registry-specific module version argument; this mechanism is useful when the job is to pin a VCS module to a specific Git branch, tag or commit, whereas the current scenario requires the engineer to install all referenced remote child modules before planning. These operations have different effects in the stated Terraform workflow.

E:

Registry module sources use the namespace/name/provider address form and can support a separate version argument; this mechanism is useful when the job is to download a community module published with an official registry address, whereas the current scenario requires the engineer to install all referenced remote child modules before planning. These operations have different effects in the stated Terraform workflow.

Question 517

An organization integrating Terraform with source control has a concrete implementation goal: connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io. What is the most appropriate Terraform mechanism?

  1. A cloud workspaces tags setting
  2. Terraform Enterprise hostname selection
  3. A cloud block project selector
  4. HCP Terraform run tasks integration

Explanation

Correct Answer

B:

The cloud hostname setting and login host identify the relevant service installation for organization operations; this directly meets the requirement to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io. By comparison, a cloud workspaces tags setting is intended to select an HCP Terraform workspace collection by workspace tags, which is a different task from connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io.

Incorrect Answers

A:

The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form; this mechanism is useful when the job is to select an HCP Terraform workspace collection by workspace tags, whereas the current scenario requires the engineer to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io. These operations have different effects in the stated Terraform workflow.

C:

The cloud workspaces block supports a project setting for organizing related workspace integration; this mechanism is useful when the job is to associate an HCP Terraform workspace with an intended project during configuration, whereas the current scenario requires the engineer to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io. These operations have different effects in the stated Terraform workflow.

D:

Run tasks integrate external systems into workflow checkpoints without changing the Terraform resource graph directly; this mechanism is useful when the job is to send proposed changes to a third-party quality or security check service, whereas the current scenario requires the engineer to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io. These operations have different effects in the stated Terraform workflow.

Question 518

During one infrastructure delivery, the team must satisfy all of the following: (1) confirm deployed outputs and state match the expected result; (2) run declarative module tests instead of only checking syntax. Select TWO appropriate Terraform approaches. Choose TWO.

  1. terraform test
  2. Check infrastructure after apply
  3. Separate plan and apply privileges
  4. Initialize after checkout
  5. Iterate after feedback
  6. A type mismatch diagnosis

Explanation

Correct Answers

A:

The Terraform test command executes defined test runs and assertions, which can exercise behavior beyond basic configuration validation; this meets the requirement to run declarative module tests instead of only checking syntax, while the other selected techniques address confirm deployed outputs and state match the expected result, which require their own distinct Terraform mechanisms.

B:

Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift; this meets the requirement to confirm deployed outputs and state match the expected result, while the other selected techniques address run declarative module tests instead of only checking syntax, which require their own distinct Terraform mechanisms.

Incorrect Answers

C:

Teams can make planning a review step and reserve apply execution for an authorized operator or HCP Terraform run; it addresses require approval before an infrastructure change executes, but this delivery instead requires confirm deployed outputs and state match the expected result and run declarative module tests instead of only checking syntax. The required combination involves Check infrastructure after apply and terraform test, not the behavior of Separate plan and apply privileges.

D:

Running terraform init configures backend access, child modules and required providers before plans can run; it addresses prepare a newly cloned root module for local Terraform operations, but this delivery instead requires confirm deployed outputs and state match the expected result and run declarative module tests instead of only checking syntax. The required combination involves Check infrastructure after apply and terraform test, not the behavior of Initialize after checkout.

E:

A revised configuration must be planned again because a prior plan does not automatically incorporate later edits; it addresses modify and re-plan after a change request is rejected, but this delivery instead requires confirm deployed outputs and state match the expected result and run declarative module tests instead of only checking syntax. The required combination involves Check infrastructure after apply and terraform test, not the behavior of Iterate after feedback.

F:

Provider schemas and Terraform's type checking can make validate fail before an apply is attempted; it addresses catch an argument whose expression does not match the provider schema, but this delivery instead requires confirm deployed outputs and state match the expected result and run declarative module tests instead of only checking syntax. The required combination involves Check infrastructure after apply and terraform test, not the behavior of A type mismatch diagnosis.

Question 519

A change request asks an engineer to reduce whitespace-only churn in infrastructure pull requests. Which choice best implements the requested behavior?

  1. Format before source review
  2. terraform fmt -diff
  3. terraform fmt -recursive
  4. Formatting versus validation

Explanation

Correct Answer

A:

Applying formatter conventions consistently makes code review focus on meaningful resource and expression edits; this directly meets the requirement to reduce whitespace-only churn in infrastructure pull requests. By comparison, terraform fmt -diff is intended to show which HCL formatting edits Terraform would make, which is a different task from reduce whitespace-only churn in infrastructure pull requests.

Incorrect Answers

B:

The diff switch displays textual differences between current file formatting and the canonical formatting result; this mechanism is useful when the job is to show which HCL formatting edits Terraform would make, whereas the current scenario requires the engineer to reduce whitespace-only churn in infrastructure pull requests. These operations have different effects in the stated Terraform workflow.

C:

The recursive switch extends formatting into subdirectories rather than limiting the operation to the current directory; this mechanism is useful when the job is to format Terraform files in nested directories under a module tree, whereas the current scenario requires the engineer to reduce whitespace-only churn in infrastructure pull requests. These operations have different effects in the stated Terraform workflow.

D:

terraform fmt addresses canonical HCL layout while terraform validate checks whether the configuration is structurally acceptable; this mechanism is useful when the job is to distinguish style-only issues from Terraform type and schema errors, whereas the current scenario requires the engineer to reduce whitespace-only churn in infrastructure pull requests. These operations have different effects in the stated Terraform workflow.

Question 520

A runbook lists “Initialize after checkout” for the task to prepare a newly cloned root module for local Terraform operations. Which technical effect should its description include?

  1. Teams can make planning a review step and reserve apply execution for an authorized operator or HCP Terraform run.
  2. The plan stage compares desired configuration with observed resource state and shows the proposed operations for review.
  3. Running terraform init configures backend access, child modules and required providers before plans can run.
  4. A revised configuration must be planned again because a prior plan does not automatically incorporate later edits.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to prepare a newly cloned root module for local Terraform operations, so it produces the behavior described. In contrast, separate plan and apply privileges serves a different goal: require approval before an infrastructure change executes, not prepare a newly cloned root module for local Terraform operations.

Incorrect Answers

A:

The description applies to separate plan and apply privileges when an engineer needs to require approval before an infrastructure change executes; the named initialize after checkout instead handles the requirement to prepare a newly cloned root module for local Terraform operations, so this behavior does not describe Initialize after checkout in the situation named.

B:

The description applies to review a plan before apply when an engineer needs to inspect predicted create, update and delete actions prior to making changes; the named initialize after checkout instead handles the requirement to prepare a newly cloned root module for local Terraform operations, so this behavior does not describe Initialize after checkout in the situation named.

D:

The description applies to iterate after feedback when an engineer needs to modify and re-plan after a change request is rejected; the named initialize after checkout instead handles the requirement to prepare a newly cloned root module for local Terraform operations, so this behavior does not describe Initialize after checkout in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests