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

Question 1090

An engineer intends to extract a primitive output without the surrounding formatted representation and is reviewing “terraform output -raw”. What consequence follows from using it as intended?

  1. The -raw output mode prints a single string, number or boolean value in a script-friendly form and may reveal sensitive data.
  2. Terraform reads variables named TF_VAR_name as a source of input assignments, subject to input precedence rules.
  3. Command-line -var assignments take high precedence and are useful for an explicit run-specific override.
  4. The module block assigns arguments corresponding to input variables declared in the child; variables are scoped to modules.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to extract a primitive output without the surrounding formatted representation, so it produces the behavior described. In contrast, the -var option serves a different goal: supply a single variable assignment when invoking plan or apply, not extract a primitive output without the surrounding formatted representation.

Incorrect Answers

B:

The description applies to an environment variable prefixed TF_VAR_ when an engineer needs to provide root-module input values from an automated execution environment; the named terraform output -raw instead handles the requirement to extract a primitive output without the surrounding formatted representation, so this behavior does not describe terraform output -raw in the situation named.

C:

The description applies to the -var option when an engineer needs to supply a single variable assignment when invoking plan or apply; the named terraform output -raw instead handles the requirement to extract a primitive output without the surrounding formatted representation, so this behavior does not describe terraform output -raw in the situation named.

D:

The description applies to passing module inputs explicitly when an engineer needs to configure a child module with parent-provided values; the named terraform output -raw instead handles the requirement to extract a primitive output without the surrounding formatted representation, so this behavior does not describe terraform output -raw in the situation named.

Question 1091

An engineer intends to track resources in distinct providers together within the chosen state scope and is reviewing “Multi-cloud state visibility”. What consequence follows from using it as intended?

  1. A shared Terraform language does not erase provider API differences; each provider defines supported resource schemas and behavior.
  2. Each provider configuration supplies or discovers credentials appropriate to the API it calls, rather than sharing a universal Terraform credential.
  3. Terraform Core offers common configuration and state mechanisms while provider schemas capture each platform's API differences.
  4. One Terraform state can map managed resources from multiple providers, although separate configurations may improve blast-radius isolation.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to track resources in distinct providers together within the chosen state scope, so it produces the behavior described. In contrast, provider authentication per service serves a different goal: authorize Terraform separately for two different infrastructure APIs, not track resources in distinct providers together within the chosen state scope.

Incorrect Answers

A:

The description applies to provider-specific capabilities when an engineer needs to avoid assuming that all providers expose identical resource types and options; the named multi-cloud state visibility instead handles the requirement to track resources in distinct providers together within the chosen state scope, so this behavior does not describe Multi-cloud state visibility in the situation named.

B:

The description applies to provider authentication per service when an engineer needs to authorize Terraform separately for two different infrastructure APIs; the named multi-cloud state visibility instead handles the requirement to track resources in distinct providers together within the chosen state scope, so this behavior does not describe Multi-cloud state visibility in the situation named.

C:

The description applies to service-agnostic resource modeling when an engineer needs to use a common configuration workflow across distinct vendors; the named multi-cloud state visibility instead handles the requirement to track resources in distinct providers together within the chosen state scope, so this behavior does not describe Multi-cloud state visibility in the situation named.

Question 1092

During a design review, the requirement is to feed a saved plan to a machine-readable analysis tool. Which option should the engineer select?

  1. The dependency graph during planning
  2. A resource action marked minus
  3. An unknown value until apply
  4. terraform show -json on a plan

Explanation

Correct Answer

D:

The -json flag emits a structured JSON representation suitable for inspection by automation, with careful handling of sensitive output; this directly meets the requirement to feed a saved plan to a machine-readable analysis tool. By comparison, an unknown value until apply is intended to understand why a computed attribute is unavailable in the preview, which is a different task from feed a saved plan to a machine-readable analysis tool.

Incorrect Answers

A:

Terraform graph nodes can run concurrently when no dependency edge requires a particular order; this mechanism is useful when the job is to explain why two unrelated resources can be planned and applied in parallel, whereas the current scenario requires the engineer to feed a saved plan to a machine-readable analysis tool. These operations have different effects in the stated Terraform workflow.

B:

In human-readable plans, - denotes a planned destruction of a managed resource; this mechanism is useful when the job is to interpret a plan showing a resource that Terraform will destroy, whereas the current scenario requires the engineer to feed a saved plan to a machine-readable analysis tool. These operations have different effects in the stated Terraform workflow.

C:

Terraform may mark attributes as known after apply because a provider assigns their values only when creating or updating a real object; this mechanism is useful when the job is to understand why a computed attribute is unavailable in the preview, whereas the current scenario requires the engineer to feed a saved plan to a machine-readable analysis tool. These operations have different effects in the stated Terraform workflow.

Question 1093

An HCP Terraform workspace design has a concrete implementation goal: require an authorized person to approve a run before applying changes. What is the most appropriate Terraform mechanism?

  1. Project-based permission boundaries
  2. HCP continuous validation
  3. OPA policy enforcement
  4. Workspace run approvals

Explanation

Correct Answer

D:

HCP Terraform approval workflow separates viewing a plan from the permission to proceed with an apply; this directly meets the requirement to require an authorized person to approve a run before applying changes. By comparison, HCP continuous validation is intended to monitor whether infrastructure-specific check assertions still pass after deployment, which is a different task from require an authorized person to approve a run before applying changes.

Incorrect Answers

A:

Projects group workspaces and support scoped access management for organizational teams; this mechanism is useful when the job is to delegate administration of grouped HCP Terraform workspaces, whereas the current scenario requires the engineer to require an authorized person to approve a run before applying changes. These operations have different effects in the stated Terraform workflow.

B:

Continuous validation can evaluate configuration check blocks to identify operational health issues in supported workspaces; this mechanism is useful when the job is to monitor whether infrastructure-specific check assertions still pass after deployment, whereas the current scenario requires the engineer to require an authorized person to approve a run before applying changes. These operations have different effects in the stated Terraform workflow.

C:

HCP Terraform supports OPA-based policy sets for automated governance on applicable runs; this mechanism is useful when the job is to check proposed infrastructure against rules expressed in Open Policy Agent policies, whereas the current scenario requires the engineer to require an authorized person to approve a run before applying changes. These operations have different effects in the stated Terraform workflow.

Question 1094

A team compares Terraform mechanisms for the goal to refer to shared infrastructure that another stack owns without changing its lifecycle. Which stated consequence belongs specifically to “A data source instead of import”?

  1. Providers refresh remote resource attributes, and planning can propose updates to bring changed objects back to declared configuration.
  2. The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed.
  3. The state mv command reassigns a managed resource's address without contacting the provider to destroy the object.
  4. A data block can read an external object's attributes while avoiding taking over its create-update-delete lifecycle.
  5. If a provider reports a tracked object no longer exists, a normal plan generally proposes recreating it when its resource block remains.
  6. Refresh-only planning previews proposed changes to state or root outputs; the plan itself does not persist them until an apply operation.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to refer to shared infrastructure that another stack owns without changing its lifecycle, so it produces the behavior described. In contrast, a normal plan with drift serves a different goal: detect and propose correction for changes made outside Terraform, not refer to shared infrastructure that another stack owns without changing its lifecycle.

Incorrect Answers

A:

The description applies to a normal plan with drift when an engineer needs to detect and propose correction for changes made outside Terraform; the named a data source instead of import instead handles the requirement to refer to shared infrastructure that another stack owns without changing its lifecycle, so this behavior does not describe A data source instead of import in the situation named.

B:

The description applies to ignore_changes for shared ownership when an engineer needs to stop Terraform from overwriting a field delegated to an external controller; the named a data source instead of import instead handles the requirement to refer to shared infrastructure that another stack owns without changing its lifecycle, so this behavior does not describe A data source instead of import in the situation named.

C:

The description applies to terraform state mv when an engineer needs to change the address of a tracked object directly within state; the named a data source instead of import instead handles the requirement to refer to shared infrastructure that another stack owns without changing its lifecycle, so this behavior does not describe A data source instead of import in the situation named.

E:

The description applies to a refreshed missing resource when an engineer needs to understand why Terraform proposes creating a managed object deleted outside the workflow; the named a data source instead of import instead handles the requirement to refer to shared infrastructure that another stack owns without changing its lifecycle, so this behavior does not describe A data source instead of import in the situation named.

F:

The description applies to terraform plan -refresh-only when an engineer needs to preview proposed state-only changes without changing remote objects or committing new state; the named a data source instead of import instead handles the requirement to refer to shared infrastructure that another stack owns without changing its lifecycle, so this behavior does not describe A data source instead of import in the situation named.

Question 1095

The team evaluates “A resource action marked plus” for a requirement to interpret the leading + symbol in Terraform's plan. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. Disabling refresh reduces remote reads but can hide drift and produce an inaccurate plan based on stale observations.
  2. Terraform graph nodes can run concurrently when no dependency edge requires a particular order.
  3. Refresh-only planning proposes changes to Terraform state or root outputs based on remote observations, without proposing ordinary resource updates.
  4. The -out option writes a saved plan so the reviewed actions can be supplied to terraform apply without recomputing from modified inputs.
  5. In conventional human-readable plans, + signifies that a managed resource is proposed for creation.

Explanation

Correct Answer

E:

The named mechanism is used when the objective is to interpret the leading + symbol in Terraform's plan, so it produces the behavior described. In contrast, terraform plan -out serves a different goal: save an execution plan to a binary file for later application, not interpret the leading + symbol in Terraform's plan.

Incorrect Answers

A:

The description applies to terraform plan -refresh=false when an engineer needs to skip routine state refresh for a constrained preview; the named a resource action marked plus instead handles the requirement to interpret the leading + symbol in Terraform's plan, so this behavior does not describe A resource action marked plus in the situation named.

B:

The description applies to the dependency graph during planning when an engineer needs to explain why two unrelated resources can be planned and applied in parallel; the named a resource action marked plus instead handles the requirement to interpret the leading + symbol in Terraform's plan, so this behavior does not describe A resource action marked plus in the situation named.

C:

The description applies to terraform plan -refresh-only when an engineer needs to propose updating state or root outputs to reflect remote changes without planning infrastructure remediation; the named a resource action marked plus instead handles the requirement to interpret the leading + symbol in Terraform's plan, so this behavior does not describe A resource action marked plus in the situation named.

D:

The description applies to terraform plan -out when an engineer needs to save an execution plan to a binary file for later application; the named a resource action marked plus instead handles the requirement to interpret the leading + symbol in Terraform's plan, so this behavior does not describe A resource action marked plus in the situation named.

Question 1096

A Terraform change proposal names “A refreshed changed resource” to understand why Terraform tries to reset a manually edited resource attribute. Which outcome can reviewers attribute to that particular mechanism?

  1. Manual state-file changes can break address mappings or serial consistency; commands such as state mv and moved blocks are safer.
  2. State metadata such as lineage and serial helps protect against incompatible or stale state updates.
  3. Configuration still describes the preferred value, so normal planning can propose undoing an out-of-band modification unless ignored.
  4. Refresh-only apply can update the recorded state to match observed remote attributes without modifying cloud resources.
  5. A data block can read an external object's attributes while avoiding taking over its create-update-delete lifecycle.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to understand why Terraform tries to reset a manually edited resource attribute, so it produces the behavior described. In contrast, a data source instead of import serves a different goal: refer to shared infrastructure that another stack owns without changing its lifecycle, not understand why Terraform tries to reset a manually edited resource attribute.

Incorrect Answers

A:

The description applies to avoid direct state JSON editing when an engineer needs to make state changes through supported Terraform commands and declarative refactors; the named a refreshed changed resource instead handles the requirement to understand why Terraform tries to reset a manually edited resource attribute, so this behavior does not describe A refreshed changed resource in the situation named.

B:

The description applies to serial and lineage checks when an engineer needs to detect that a state snapshot belongs to a different history or older generation; the named a refreshed changed resource instead handles the requirement to understand why Terraform tries to reset a manually edited resource attribute, so this behavior does not describe A refreshed changed resource in the situation named.

D:

The description applies to terraform apply -refresh-only when an engineer needs to accept current remote readings into Terraform's state through an apply operation; the named a refreshed changed resource instead handles the requirement to understand why Terraform tries to reset a manually edited resource attribute, so this behavior does not describe A refreshed changed resource in the situation named.

E:

The description applies to a data source instead of import when an engineer needs to refer to shared infrastructure that another stack owns without changing its lifecycle; the named a refreshed changed resource instead handles the requirement to understand why Terraform tries to reset a manually edited resource attribute, so this behavior does not describe A refreshed changed resource in the situation named.

Question 1097

A Terraform change proposal names “Refresh during apply planning” to avoid applying from stale remembered attributes after remote drift. Which outcome can reviewers attribute to that particular mechanism?

  1. The parallelism setting controls Terraform's concurrent resource operation count, which can mitigate API throttling.
  2. Terraform executes actions in graph order and can operate on independent nodes in parallel subject to provider and CLI limits.
  3. The -input=false option prevents prompts for missing input, requiring all necessary values and approvals to be handled by automation.
  4. For a normal fresh apply, Terraform plans with current provider observations unless refresh is explicitly disabled; saved plan behavior differs.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to avoid applying from stale remembered attributes after remote drift, so it produces the behavior described. In contrast, parallel graph execution serves a different goal: allow independent resources to be applied concurrently, not avoid applying from stale remembered attributes after remote drift.

Incorrect Answers

A:

The description applies to terraform apply -parallelism when an engineer needs to limit how many graph operations execute concurrently; the named refresh during apply planning instead handles the requirement to avoid applying from stale remembered attributes after remote drift, so this behavior does not describe Refresh during apply planning in the situation named.

B:

The description applies to parallel graph execution when an engineer needs to allow independent resources to be applied concurrently; the named refresh during apply planning instead handles the requirement to avoid applying from stale remembered attributes after remote drift, so this behavior does not describe Refresh during apply planning in the situation named.

C:

The description applies to noninteractive apply settings when an engineer needs to run Terraform in automation where prompting is not acceptable; the named refresh during apply planning instead handles the requirement to avoid applying from stale remembered attributes after remote drift, so this behavior does not describe Refresh during apply planning in the situation named.

Question 1098

A change request asks an engineer to remove dependent resources before objects they rely on. Which choice best implements the requested behavior?

  1. Dependency-aware deletion
  2. terraform apply -destroy
  3. terraform plan -destroy
  4. terraform destroy

Explanation

Correct Answer

A:

Terraform generally reverses dependency order when destroying managed resources so dependent objects are removed first; this directly meets the requirement to remove dependent resources before objects they rely on. By comparison, terraform plan -destroy is intended to review an all-destroy plan before approving resource deletion, which is a different task from remove dependent resources before objects they rely on.

Incorrect Answers

B:

The destroy mode tells apply to plan removal of managed resources rather than ordinary convergence to resource declarations; this mechanism is useful when the job is to execute a destroy-mode apply within a controlled workflow, whereas the current scenario requires the engineer to remove dependent resources before objects they rely on. These operations have different effects in the stated Terraform workflow.

C:

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 remove dependent resources before objects they rely on. These operations have different effects in the stated Terraform workflow.

D:

The destroy command plans and applies removal of managed objects subject to lifecycle and provider constraints; this mechanism is useful when the job is to remove the managed infrastructure described by the current Terraform configuration, whereas the current scenario requires the engineer to remove dependent resources before objects they rely on. These operations have different effects in the stated Terraform workflow.

Question 1099

A Terraform reviewer encounters “State consistency during CI” while assessing how to keep two pipelines from changing the same infrastructure state simultaneously. Which statement correctly describes its actual behavior?

  1. A state backend with locking helps serialize competing changes, complemented by pipeline approval and run coordination.
  2. Backend state locking behavior depends on the backend implementation; remote storage alone does not guarantee safe locking.
  3. The lock-timeout option lets Terraform retry lock acquisition for a specified duration before returning an error.
  4. A lock may belong to another active run, so check its identity and run status rather than immediately forcing removal.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to keep two pipelines from changing the same infrastructure state simultaneously, so it produces the behavior described. In contrast, lock ownership verification serves a different goal: confirm that a held lock is stale before attempting manual removal, not keep two pipelines from changing the same infrastructure state simultaneously.

Incorrect Answers

B:

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

C:

The description applies to terraform plan -lock-timeout when an engineer needs to wait for a temporary state lock instead of failing immediately; the named state consistency during CI instead handles the requirement to keep two pipelines from changing the same infrastructure state simultaneously, so this behavior does not describe State consistency during CI in the situation named.

D:

The description applies to lock ownership verification when an engineer needs to confirm that a held lock is stale before attempting manual removal; the named state consistency during CI instead handles the requirement to keep two pipelines from changing the same infrastructure state simultaneously, so this behavior does not describe State consistency during CI in the situation named.

Question 1100

A provider configuration review needs to detect actual resource attributes rather than relying only on historical saved values. Which feature or operation is the most direct match?

  1. State locking
  2. State resource addresses
  3. Terraform refresh during planning
  4. Separate state per environment

Explanation

Correct Answer

C:

A normal plan attempts to refresh state from providers before comparing objects to the current configuration; this directly meets the requirement to detect actual resource attributes rather than relying only on historical saved values. By comparison, terraform state list is intended to inspect the addresses of instances currently tracked in state, which is a different task from detect actual resource attributes rather than relying only on historical saved values.

Incorrect Answers

A:

A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes; this concerns the task to prevent concurrent state writers from overwriting each other's updates, not the current need to detect actual resource attributes rather than relying only on historical saved values. A Terraform refresh during planning approach is appropriate here; the substituted State locking option does not supply the specified Terraform capability.

B:

State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons; this mechanism is useful when the job is to identify which remote object corresponds to a particular configuration resource, whereas the current scenario requires the engineer to detect actual resource attributes rather than relying only on historical saved values. These operations have different effects in the stated Terraform workflow.

D:

Distinct backends, workspaces or root configurations can isolate state, but the configuration must target the intended instance set; this mechanism is useful when the job is to prevent staging changes from unintentionally sharing the production state mapping, whereas the current scenario requires the engineer to detect actual resource attributes rather than relying only on historical saved values. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests