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

Question 540

A Terraform state maintenance procedure requires a way to release a stale lock when the original process is definitively gone. Which Terraform approach most directly fulfills that request?

  1. HCP Terraform run serialization
  2. terraform force-unlock
  3. terraform plan -lock-timeout
  4. State consistency during CI

Explanation

Correct Answer

B:

The force-unlock command removes a lock by its identifier; using it during an active operation can cause state corruption; this directly meets the requirement to release a stale lock when the original process is definitively gone. By comparison, HCP Terraform run serialization is intended to avoid multiple infrastructure applies targeting the same shared HCP workspace state, which is a different task from release a stale lock when the original process is definitively gone.

Incorrect Answers

A:

HCP Terraform coordinates workspace runs and state handling, reducing conflicts among collaborating operators; this mechanism is useful when the job is to avoid multiple infrastructure applies targeting the same shared HCP workspace state, whereas the current scenario requires the engineer to release a stale lock when the original process is definitively gone. These operations have different effects in the stated Terraform workflow.

C:

The lock-timeout option lets Terraform retry lock acquisition for a specified duration before returning an error; this mechanism is useful when the job is to wait for a temporary state lock instead of failing immediately, whereas the current scenario requires the engineer to release a stale lock when the original process is definitively gone. These operations have different effects in the stated Terraform workflow.

D:

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 release a stale lock when the original process is definitively gone. These operations have different effects in the stated Terraform workflow.

Question 541

A team onboarding previously deployed infrastructure requires a way to enable diagnostic output with lower verbosity than TRACE. Which Terraform approach most directly fulfills that request?

  1. TF_LOG=DEBUG
  2. TF_LOG_PROVIDER
  3. TF_LOG_PATH
  4. TF_LOG=INFO

Explanation

Correct Answer

A:

Setting TF_LOG to DEBUG exposes useful troubleshooting messages without the full trace-level volume; this directly meets the requirement to enable diagnostic output with lower verbosity than TRACE. By comparison, TF_LOG=INFO is intended to record higher-level operational messages during troubleshooting, which is a different task from enable diagnostic output with lower verbosity than TRACE.

Incorrect Answers

B:

The TF_LOG_PROVIDER setting controls provider log verbosity and can help locate failures involving provider communication; this mechanism is useful when the job is to isolate provider-related diagnostic output during API troubleshooting, whereas the current scenario requires the engineer to enable diagnostic output with lower verbosity than TRACE. These operations have different effects in the stated Terraform workflow.

C:

TF_LOG_PATH directs log output to a file and should be combined with an enabled TF_LOG level; this mechanism is useful when the job is to save enabled Terraform diagnostic logs to a designated file, whereas the current scenario requires the engineer to enable diagnostic output with lower verbosity than TRACE. These operations have different effects in the stated Terraform workflow.

D:

INFO logging provides operational context with less detail than DEBUG and TRACE; this mechanism is useful when the job is to record higher-level operational messages during troubleshooting, whereas the current scenario requires the engineer to enable diagnostic output with lower verbosity than TRACE. These operations have different effects in the stated Terraform workflow.

Question 542

A Terraform deployment has independent requirements: (1) extract a primitive output without the surrounding formatted representation; (2) select between two expression results based on a boolean predicate. Which TWO mechanisms directly address these needs? Choose TWO.

  1. terraform output -raw
  2. A conditional expression
  3. The variable type argument
  4. An environment variable prefixed TF_VAR_
  5. A list of strings type

Explanation

Correct Answers

A:

The -raw output mode prints a single string, number or boolean value in a script-friendly form and may reveal sensitive data; this meets the requirement to extract a primitive output without the surrounding formatted representation, while the other selected techniques address select between two expression results based on a boolean predicate, which require their own distinct Terraform mechanisms.

B:

Terraform's condition ? true_value : false_value syntax chooses one branch while reconciling compatible result types; this meets the requirement to select between two expression results based on a boolean predicate, while the other selected techniques address extract a primitive output without the surrounding formatted representation, which require their own distinct Terraform mechanisms.

Incorrect Answers

C:

A variable's type constraint enforces the intended structure and allows appropriate Terraform type conversions; it addresses reject caller values that cannot satisfy the declared input type, but this delivery instead requires extract a primitive output without the surrounding formatted representation and select between two expression results based on a boolean predicate. The required combination involves terraform output -raw and A conditional expression, not the behavior of The variable type argument.

D:

Terraform reads variables named TF_VAR_name as a source of input assignments, subject to input precedence rules; it addresses provide root-module input values from an automated execution environment, but this delivery instead requires extract a primitive output without the surrounding formatted representation and select between two expression results based on a boolean predicate. The required combination involves terraform output -raw and A conditional expression, not the behavior of An environment variable prefixed TF_VAR_.

E:

The type constraint list(string) represents ordered string elements and supports numeric indexing, preserving element order; it addresses accept an ordered collection of same-type string values, but this delivery instead requires extract a primitive output without the surrounding formatted representation and select between two expression results based on a boolean predicate. The required combination involves terraform output -raw and A conditional expression, not the behavior of A list of strings type.

Question 543

A runbook lists “A resource attribute reference” for the task to pass a newly managed object's computed identifier to a dependent resource. Which technical effect should its description include?

  1. A removed block with destroy = false can express a configuration-driven removal from state while leaving the infrastructure object intact.
  2. A resource type name usually starts with its provider local name, such as aws_instance for the AWS provider.
  3. A provider data source can resolve the zone ID for use in managed records while the zone itself remains outside that configuration's resource lifecycle.
  4. References like aws_vpc.main.id use a managed resource's attributes and create an implicit dependency.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to pass a newly managed object's computed identifier to a dependent resource, so it produces the behavior described. In contrast, data sources as external lookups serves a different goal: use an existing DNS zone from a provider without taking ownership of the zone, not pass a newly managed object's computed identifier to a dependent resource.

Incorrect Answers

A:

The description applies to resource removal without deletion when an engineer needs to retain a remote object but stop Terraform from managing it; the named a resource attribute reference instead handles the requirement to pass a newly managed object's computed identifier to a dependent resource, so this behavior does not describe A resource attribute reference in the situation named.

B:

The description applies to provider resource type prefixes when an engineer needs to identify which provider implements a resource's API operations; the named a resource attribute reference instead handles the requirement to pass a newly managed object's computed identifier to a dependent resource, so this behavior does not describe A resource attribute reference in the situation named.

C:

The description applies to data sources as external lookups when an engineer needs to use an existing DNS zone from a provider without taking ownership of the zone; the named a resource attribute reference instead handles the requirement to pass a newly managed object's computed identifier to a dependent resource, so this behavior does not describe A resource attribute reference in the situation named.

Question 544

During one infrastructure delivery, the team must satisfy all of the following: (1) define which configuration branch or directory produces automatic runs; (2) select an HCP Terraform workspace collection by workspace tags. Select TWO appropriate Terraform approaches. Choose TWO.

  1. Variable sets scoped to workspaces
  2. Terraform Enterprise hostname selection
  3. A workspace's VCS repository settings
  4. HCP Terraform organization separation
  5. A cloud workspaces tags setting

Explanation

Correct Answers

C:

VCS connection details identify the source code changes that should trigger a workspace's Terraform run; this meets the requirement to define which configuration branch or directory produces automatic runs, while the other selected techniques address select an HCP Terraform workspace collection by workspace tags, which require their own distinct Terraform mechanisms.

E:

The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form; this meets the requirement to select an HCP Terraform workspace collection by workspace tags, while the other selected techniques address define which configuration branch or directory produces automatic runs, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

A variable set may apply to selected workspaces instead of every workspace in an organization; it addresses share credentials only with selected approved infrastructure scopes, but this delivery instead requires define which configuration branch or directory produces automatic runs and select an HCP Terraform workspace collection by workspace tags. The required combination involves A workspace's VCS repository settings and A cloud workspaces tags setting, not the behavior of Variable sets scoped to workspaces.

B:

The cloud hostname setting and login host identify the relevant service installation for organization operations; it addresses connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, but this delivery instead requires define which configuration branch or directory produces automatic runs and select an HCP Terraform workspace collection by workspace tags. The required combination involves A workspace's VCS repository settings and A cloud workspaces tags setting, not the behavior of Terraform Enterprise hostname selection.

D:

Organizations provide a broader boundary containing projects, workspaces, teams and policy configuration; it addresses separate independent business units with different governance needs, but this delivery instead requires define which configuration branch or directory produces automatic runs and select an HCP Terraform workspace collection by workspace tags. The required combination involves A workspace's VCS repository settings and A cloud workspaces tags setting, not the behavior of HCP Terraform organization separation.

Question 545

During a design review, the requirement is to stop tracking a resource without telling its provider to delete the remote object. Which option should the engineer select?

  1. terraform workspace select
  2. terraform output
  3. terraform state replace-provider
  4. terraform state rm
  5. terraform workspace list

Explanation

Correct Answer

D:

State rm deletes the state association, not the object in the external system; this directly meets the requirement to stop tracking a resource without telling its provider to delete the remote object. By comparison, terraform output is intended to read values explicitly declared as root outputs of the configuration, which is a different task from stop tracking a resource without telling its provider to delete the remote object.

Incorrect Answers

A:

Workspace selection changes which workspace state namespace the root configuration uses; it does not select a cloud account automatically; this mechanism is useful when the job is to switch the currently selected Terraform CLI workspace, whereas the current scenario requires the engineer to stop tracking a resource without telling its provider to delete the remote object. These operations have different effects in the stated Terraform workflow.

B:

The output command reports root output values rather than listing every raw attribute from state; this mechanism is useful when the job is to read values explicitly declared as root outputs of the configuration, whereas the current scenario requires the engineer to stop tracking a resource without telling its provider to delete the remote object. These operations have different effects in the stated Terraform workflow.

C:

Replace-provider rewrites provider source references in state and creates a backup before the edit; this mechanism is useful when the job is to update the provider source address recorded for affected state resources, whereas the current scenario requires the engineer to stop tracking a resource without telling its provider to delete the remote object. These operations have different effects in the stated Terraform workflow.

E:

Workspace list shows logical Terraform workspaces, which may correspond to separate state instances depending on backend support; this mechanism is useful when the job is to list the workspaces available through the initialized backend, whereas the current scenario requires the engineer to stop tracking a resource without telling its provider to delete the remote object. These operations have different effects in the stated Terraform workflow.

Question 546

A team proposes “ignore_changes for shared ownership” to rename or relocate a managed resource address without recreating the remote object. If they proceed with that technique, which result should they anticipate instead?

  1. A removed block can intentionally forget the previous resource address without a provider delete when lifecycle destroy is false.
  2. A moved block maps an old Terraform address to a new one so state follows the refactor rather than planning destruction and creation.
  3. Configuration still describes the preferred value, so normal planning can propose undoing an out-of-band modification unless ignored.
  4. The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed.

Explanation

Correct Answer

D:

ignore_changes for shared ownership is used when an operator needs to stop Terraform from overwriting a field delegated to an external controller. Consequently, this choice cannot meet the separate requirement to rename or relocate a managed resource address without recreating the remote object. The intended action would instead require A moved block.

Incorrect Answers

A:

This behavior belongs to A removed block with destroy=false, which helps engineers declare that a resource should leave management while its actual object is retained rather than satisfying the separate requirement to rename or relocate a managed resource address without recreating the remote object. The attempted technique was ignore_changes for shared ownership; it would instead be used to stop Terraform from overwriting a field delegated to an external controller, not to produce the effect associated with A removed block with destroy=false.

B:

That outcome belongs to A moved block, the mechanism that can rename or relocate a managed resource address without recreating the remote object. The question concerns the engineer’s actual proposal, ignore_changes for shared ownership; it is directed at stop Terraform from overwriting a field delegated to an external controller, not that result.

C:

This behavior belongs to A refreshed changed resource, which helps engineers understand why Terraform tries to reset a manually edited resource attribute rather than satisfying the separate requirement to rename or relocate a managed resource address without recreating the remote object. The attempted technique was ignore_changes for shared ownership; it would instead be used to stop Terraform from overwriting a field delegated to an external controller, not to produce the effect associated with A refreshed changed resource.

Question 547

During an infrastructure design review about how to check whether a chosen remote backend actually offers state locking, a maintainer asks what “Backend-specific lock support” does. Which description is accurate?

  1. A state backend with locking helps serialize competing changes, complemented by pipeline approval and run coordination.
  2. Supported backends acquire a state lock so simultaneous writers cannot corrupt or overwrite each other's state changes.
  3. Backend state locking behavior depends on the backend implementation; remote storage alone does not guarantee safe locking.
  4. Terraform obtains and releases supported backend locks around state-sensitive operations; a crash can sometimes leave manual recovery necessary.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to check whether a chosen remote backend actually offers state locking, so it produces the behavior described. In contrast, lock release after completion serves a different goal: understand why a normal Terraform operation frees the lock, not check whether a chosen remote backend actually offers state locking.

Incorrect Answers

A:

The description applies to state consistency during CI when an engineer needs to keep two pipelines from changing the same infrastructure state simultaneously; the named backend-specific lock support instead handles the requirement to check whether a chosen remote backend actually offers state locking, so this behavior does not describe Backend-specific lock support in the situation named.

B:

The description applies to a backend state lock when an engineer needs to serialize operations that write the same Terraform state; the named backend-specific lock support instead handles the requirement to check whether a chosen remote backend actually offers state locking, so this behavior does not describe Backend-specific lock support in the situation named.

D:

The description applies to lock release after completion when an engineer needs to understand why a normal Terraform operation frees the lock; the named backend-specific lock support instead handles the requirement to check whether a chosen remote backend actually offers state locking, so this behavior does not describe Backend-specific lock support in the situation named.

Question 548

A change request asks an engineer to understand when a validation cannot yet be decided at planning time. Which choice best implements the requested behavior?

  1. The error_message field
  2. Resource precondition
  3. Custom conditions with unknown values
  4. Resource postcondition

Explanation

Correct Answer

C:

Terraform may defer condition evaluation to apply when required expression values are unknown during planning; this directly meets the requirement to understand when a validation cannot yet be decided at planning time. By comparison, resource postcondition is intended to verify an invariant about a resource after reading or managing it, which is a different task from understand when a validation cannot yet be decided at planning time.

Incorrect Answers

A:

Validation, precondition and postcondition definitions use error_message to tell the operator why a rule failed; this mechanism is useful when the job is to present a meaningful explanation when a custom condition evaluates false, whereas the current scenario requires the engineer to understand when a validation cannot yet be decided at planning time. These operations have different effects in the stated Terraform workflow.

B:

A precondition inside lifecycle requires a true predicate before Terraform can continue the relevant resource operation; this mechanism is useful when the job is to fail a plan or apply when a prerequisite property is unacceptable, whereas the current scenario requires the engineer to understand when a validation cannot yet be decided at planning time. These operations have different effects in the stated Terraform workflow.

D:

A postcondition evaluates a condition concerning resource results and blocks downstream use when its assertion fails; this mechanism is useful when the job is to verify an invariant about a resource after reading or managing it, whereas the current scenario requires the engineer to understand when a validation cannot yet be decided at planning time. These operations have different effects in the stated Terraform workflow.

Question 549

During a design review, the requirement is to stop managing an existing object while preserving the real remote infrastructure. Which option should the engineer select?

  1. terraform plan -destroy
  2. Remove from state without deletion
  3. An explicit prevent_destroy rule
  4. Dependency-aware deletion

Explanation

Correct Answer

B:

Removing a state association, for example with terraform state rm, makes Terraform forget the object without asking the provider to delete it; this directly meets the requirement to stop managing an existing object while preserving the real remote infrastructure. By comparison, dependency-aware deletion is intended to remove dependent resources before objects they rely on, which is a different task from stop managing an existing object while preserving the real remote infrastructure.

Incorrect Answers

A:

Destroy planning shows the deletion proposal without carrying out the deletion until apply; this mechanism is useful when the job is to review an all-destroy plan before approving resource deletion, whereas the current scenario requires the engineer to stop managing an existing object while preserving the real remote infrastructure. These operations have different effects in the stated Terraform workflow.

C:

The lifecycle prevent_destroy setting rejects a plan that destroys or replaces a configured resource while the rule remains present; this mechanism is useful when the job is to block a destructive plan for a protected configured resource, whereas the current scenario requires the engineer to stop managing an existing object while preserving the real remote infrastructure. These operations have different effects in the stated Terraform workflow.

D:

Terraform generally reverses dependency order when destroying managed resources so dependent objects are removed first; this mechanism is useful when the job is to remove dependent resources before objects they rely on, whereas the current scenario requires the engineer to stop managing an existing object while preserving the real remote infrastructure. These operations have different effects in the stated Terraform workflow.

Question 550

A new Terraform working directory has a concrete implementation goal: install approved plugins from an internal distribution location. What is the most appropriate Terraform mechanism?

  1. A provider mirror
  2. Lockfile source control
  3. terraform init -upgrade
  4. Provider registry installation

Explanation

Correct Answer

A:

A CLI provider_installation configuration can direct provider package discovery to a network or filesystem mirror; this directly meets the requirement to install approved plugins from an internal distribution location. By comparison, provider registry installation is intended to retrieve a published plugin from its declared registry source, which is a different task from install approved plugins from an internal distribution location.

Incorrect Answers

B:

Checking .terraform.lock.hcl into version control preserves provider version selections and integrity hashes across workstations; this mechanism is useful when the job is to share repeatable plugin selections with a development team, whereas the current scenario requires the engineer to install approved plugins from an internal distribution location. These operations have different effects in the stated Terraform workflow.

C:

The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections; this mechanism is useful when the job is to intentionally reconsider previously locked provider and module selections, whereas the current scenario requires the engineer to install approved plugins from an internal distribution location. These operations have different effects in the stated Terraform workflow.

D:

Terraform uses provider source metadata and its configured installation methods to find and install the appropriate plugin binary; this mechanism is useful when the job is to retrieve a published plugin from its declared registry source, whereas the current scenario requires the engineer to install approved plugins from an internal distribution location. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests