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

Question 480

Reviewers reject “Backend configuration only in a root module” as a way to store Terraform state in a file in the working directory by default. Which actual behavior explains why the proposal is unsuitable?

  1. Backend configuration is evaluated for the root module; defining backend settings inside reusable child modules does not give them separate state.
  2. Local state can hold raw provider attributes and secrets, so filesystem access controls and encryption matter.
  3. Terraform commonly writes backup snapshots for local state updates, but backups require the same confidentiality controls as state.
  4. Without another backend, Terraform uses the local backend and writes its default workspace state to terraform.tfstate.

Explanation

Correct Answer

A:

Backend configuration only in a root module is used when an operator needs to choose where a root deployment's state will be stored. Consequently, this choice cannot meet the separate requirement to store Terraform state in a file in the working directory by default. The intended action would instead require The default local backend.

Incorrect Answers

B:

This behavior belongs to State file confidentiality, which helps engineers protect a workstation's local state file even when output values are hidden rather than satisfying the separate requirement to store Terraform state in a file in the working directory by default. The attempted technique was Backend configuration only in a root module; it would instead be used to choose where a root deployment's state will be stored, not to produce the effect associated with State file confidentiality.

C:

This behavior belongs to A local state backup file, which helps engineers recover from a state change without relying solely on an unversioned primary file rather than satisfying the separate requirement to store Terraform state in a file in the working directory by default. The attempted technique was Backend configuration only in a root module; it would instead be used to choose where a root deployment's state will be stored, not to produce the effect associated with A local state backup file.

D:

That outcome belongs to The default local backend, the mechanism that can store Terraform state in a file in the working directory by default. The question concerns the engineer’s actual proposal, Backend configuration only in a root module; it is directed at choose where a root deployment's state will be stored, not that result.

Question 481

A runbook lists “terraform plan -refresh-only” for the task to propose updating state or root outputs to reflect remote changes without planning infrastructure remediation. Which technical effect should its description include?

  1. Terraform graph nodes can run concurrently when no dependency edge requires a particular order.
  2. Refresh-only planning proposes changes to Terraform state or root outputs based on remote observations, without proposing ordinary resource updates.
  3. Plans show replacement when the provider cannot update a changed property in place; create-before-destroy can change the replacement order.
  4. In conventional human-readable plans, + signifies that a managed resource is proposed for creation.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to propose updating state or root outputs to reflect remote changes without planning infrastructure remediation, so it produces the behavior described. In contrast, a resource action marked plus serves a different goal: interpret the leading + symbol in Terraform's plan, not propose updating state or root outputs to reflect remote changes without planning infrastructure remediation.

Incorrect Answers

A:

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 terraform plan -refresh-only instead handles the requirement to propose updating state or root outputs to reflect remote changes without planning infrastructure remediation, so this behavior does not describe terraform plan -refresh-only in the situation named.

C:

The description applies to a replacement action in the plan when an engineer needs to recognize a destroy-and-create operation for an immutable argument; the named terraform plan -refresh-only instead handles the requirement to propose updating state or root outputs to reflect remote changes without planning infrastructure remediation, so this behavior does not describe terraform plan -refresh-only in the situation named.

D:

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

Question 482

A runbook lists “Dependency-aware deletion” for the task to remove dependent resources before objects they rely on. Which technical effect should its description include?

  1. Reviewing a destroy plan is essential because a command can remove every managed instance within the relevant state scope.
  2. The destroy mode tells apply to plan removal of managed resources rather than ordinary convergence to resource declarations.
  3. Terraform generally reverses dependency order when destroying managed resources so dependent objects are removed first.
  4. The lifecycle prevent_destroy setting rejects a plan that destroys or replaces a configured resource while the rule remains present.
  5. Removing a state association, for example with terraform state rm, makes Terraform forget the object without asking the provider to delete it.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to remove dependent resources before objects they rely on, so it produces the behavior described. In contrast, an explicit prevent_destroy rule serves a different goal: block a destructive plan for a protected configured resource, not remove dependent resources before objects they rely on.

Incorrect Answers

A:

The description applies to destroy plan risk review when an engineer needs to identify which root-module-managed resources will be affected before a cleanup; the named dependency-aware deletion instead handles the requirement to remove dependent resources before objects they rely on, so this behavior does not describe Dependency-aware deletion in the situation named.

B:

The description applies to terraform apply -destroy when an engineer needs to execute a destroy-mode apply within a controlled workflow; the named dependency-aware deletion instead handles the requirement to remove dependent resources before objects they rely on, so this behavior does not describe Dependency-aware deletion in the situation named.

D:

The description applies to an explicit prevent_destroy rule when an engineer needs to block a destructive plan for a protected configured resource; the named dependency-aware deletion instead handles the requirement to remove dependent resources before objects they rely on, so this behavior does not describe Dependency-aware deletion in the situation named.

E:

The description applies to remove from state without deletion when an engineer needs to stop managing an existing object while preserving the real remote infrastructure; the named dependency-aware deletion instead handles the requirement to remove dependent resources before objects they rely on, so this behavior does not describe Dependency-aware deletion in the situation named.

Question 483

A Terraform deployment has independent requirements: (1) prepare a folder containing fresh .tf configuration files; (2) check that Terraform configuration is structurally valid without planning resource changes. Which TWO mechanisms directly address these needs? Choose TWO.

  1. terraform init for a new directory
  2. Provider source change reinitialization
  3. terraform test
  4. terraform init -backend=false
  5. terraform validate
  6. terraform fmt -check

Explanation

Correct Answers

A:

Initialization installs required providers and modules and establishes the working directory's backend configuration; this meets the requirement to prepare a folder containing fresh .tf configuration files, while the other selected techniques address check that Terraform configuration is structurally valid without planning resource changes, which require their own distinct Terraform mechanisms.

E:

The validate command checks syntax and schema consistency in an initialized configuration without obtaining a full execution plan; this meets the requirement to check that Terraform configuration is structurally valid without planning resource changes, while the other selected techniques address prepare a folder containing fresh .tf configuration files, which require their own distinct Terraform mechanisms.

Incorrect Answers

B:

A modified provider requirement can trigger a need to rerun init to resolve the newly declared plugin dependency; it addresses respond after changing the source address of a required provider, but this delivery instead requires prepare a folder containing fresh .tf configuration files and check that Terraform configuration is structurally valid without planning resource changes. The required combination involves terraform init for a new directory and terraform validate, not the behavior of Provider source change reinitialization.

C:

The Terraform test command executes defined test runs and assertions, which can exercise behavior beyond basic configuration validation; it addresses run declarative module tests instead of only checking syntax, but this delivery instead requires prepare a folder containing fresh .tf configuration files and check that Terraform configuration is structurally valid without planning resource changes. The required combination involves terraform init for a new directory and terraform validate, not the behavior of terraform test.

D:

The backend=false switch suppresses backend setup; commands needing backend access may then be unable to proceed; it addresses skip backend initialization during a specialized init operation, but this delivery instead requires prepare a folder containing fresh .tf configuration files and check that Terraform configuration is structurally valid without planning resource changes. The required combination involves terraform init for a new directory and terraform validate, not the behavior of terraform init -backend=false.

F:

The fmt -check option exits with a failure status when source files would need formatting changes rather than altering them; it addresses verify formatting without rewriting the files in a CI job, but this delivery instead requires prepare a folder containing fresh .tf configuration files and check that Terraform configuration is structurally valid without planning resource changes. The required combination involves terraform init for a new directory and terraform validate, not the behavior of terraform fmt -check.

Question 484

The team evaluates “A resource action marked tilde” for a requirement to identify an in-place change rather than object recreation. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. Terraform graph nodes can run concurrently when no dependency edge requires a particular order.
  2. Disabling refresh reduces remote reads but can hide drift and produce an inaccurate plan based on stale observations.
  3. Planning calculates an execution proposal after reading configuration and usually refreshing managed resource data.
  4. In human-readable plan diffs, ~ indicates that Terraform proposes updating existing resource attributes.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to identify an in-place change rather than object recreation, so it produces the behavior described. In contrast, the dependency graph during planning serves a different goal: explain why two unrelated resources can be planned and applied in parallel, not identify an in-place change rather than object recreation.

Incorrect Answers

A:

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 tilde instead handles the requirement to identify an in-place change rather than object recreation, so this behavior does not describe A resource action marked tilde in the situation named.

B:

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 tilde instead handles the requirement to identify an in-place change rather than object recreation, so this behavior does not describe A resource action marked tilde in the situation named.

C:

The description applies to terraform plan when an engineer needs to preview resource actions implied by the current configuration and state; the named a resource action marked tilde instead handles the requirement to identify an in-place change rather than object recreation, so this behavior does not describe A resource action marked tilde in the situation named.

Question 485

A runbook lists “Explicit depends_on for side effects” for the task to order a resource after a prerequisite that has no referenced attribute. Which technical effect should its description include?

  1. Using the network object's ID in the subnet argument automatically creates a dependency edge in the graph.
  2. Terraform can request early replacement creation, but remote API constraints may disallow two objects with the same globally unique name.
  3. The depends_on meta-argument is suitable when a real dependency exists but no normal expression reference conveys it.
  4. Dependency cycles cannot be topologically ordered and require restructuring the relationships or splitting responsibilities.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to order a resource after a prerequisite that has no referenced attribute, so it produces the behavior described. In contrast, an implicit dependency through an ID serves a different goal: make a subnet wait for the network resource it references, not order a resource after a prerequisite that has no referenced attribute.

Incorrect Answers

A:

The description applies to an implicit dependency through an ID when an engineer needs to make a subnet wait for the network resource it references; the named explicit depends_on for side effects instead handles the requirement to order a resource after a prerequisite that has no referenced attribute, so this behavior does not describe Explicit depends_on for side effects in the situation named.

B:

The description applies to lifecycle ordering versus API support when an engineer needs to understand why create_before_destroy can still fail on a uniquely named object; the named explicit depends_on for side effects instead handles the requirement to order a resource after a prerequisite that has no referenced attribute, so this behavior does not describe Explicit depends_on for side effects in the situation named.

D:

The description applies to dependency cycle resolution when an engineer needs to correct a pair of modules that each require the other's output to initialize; the named explicit depends_on for side effects instead handles the requirement to order a resource after a prerequisite that has no referenced attribute, so this behavior does not describe Explicit depends_on for side effects in the situation named.

Question 486

A release pipeline preparing provider access needs to download missing required provider plugins before planning. Which feature or operation is the most direct match?

  1. A compatible provider constraint
  2. The dependency lock file
  3. A major-series compatible constraint
  4. terraform init

Explanation

Correct Answer

D:

Initialization resolves provider requirements, installs plugins, and prepares modules and backend settings in the working directory; this directly meets the requirement to download missing required provider plugins before planning. By comparison, a major-series compatible constraint is intended to accept minor and patch updates without crossing the next major version, which is a different task from download missing required provider plugins before planning.

Incorrect Answers

A:

The pessimistic constraint ~> 5.3.0 admits versions at least 5.3.0 but below 5.4.0; this mechanism is useful when the job is to accept patch updates within a chosen minor line, whereas the current scenario requires the engineer to download missing required provider plugins before planning. These operations have different effects in the stated Terraform workflow.

B:

The .terraform.lock.hcl file records selected provider versions and checksums to constrain subsequent installations; this mechanism is useful when the job is to reproduce previously selected provider package versions on other machines, whereas the current scenario requires the engineer to download missing required provider plugins before planning. These operations have different effects in the stated Terraform workflow.

C:

The pessimistic constraint ~> 5.3 permits version 5.3 and later releases below 6.0.0; this mechanism is useful when the job is to accept minor and patch updates without crossing the next major version, whereas the current scenario requires the engineer to download missing required provider plugins before planning. These operations have different effects in the stated Terraform workflow.

Question 487

An engineer intends to treat a Terraform state file as potentially sensitive data and is reviewing “State access protection”. What consequence follows from using it as intended?

  1. State can retain dependency information needed to correctly destroy objects no longer declared in configuration.
  2. State metadata includes lineage and serial information that helps Terraform identify state history and updates.
  3. Distinct backends, workspaces or root configurations can isolate state, but the configuration must target the intended instance set.
  4. State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to treat a Terraform state file as potentially sensitive data, so it produces the behavior described. In contrast, separate state per environment serves a different goal: prevent staging changes from unintentionally sharing the production state mapping, not treat a Terraform state file as potentially sensitive data.

Incorrect Answers

A:

The description applies to state-backed dependency links when an engineer needs to maintain dependencies for resources that have been removed from configuration; the named state access protection instead handles the requirement to treat a Terraform state file as potentially sensitive data, so this behavior does not describe State access protection in the situation named.

B:

The description applies to the state serial number when an engineer needs to understand how successive snapshots are ordered; the named state access protection instead handles the requirement to treat a Terraform state file as potentially sensitive data, so this behavior does not describe State access protection in the situation named.

C:

The description applies to separate state per environment when an engineer needs to prevent staging changes from unintentionally sharing the production state mapping; the named state access protection instead handles the requirement to treat a Terraform state file as potentially sensitive data, so this behavior does not describe State access protection in the situation named.

Question 488

A declarative resource and expression design requires a way to order a resource after a prerequisite that has no referenced attribute. Which Terraform approach most directly fulfills that request?

  1. ignore_changes on a tag
  2. terraform_data as a replacement trigger
  3. ignore_changes = all
  4. Resource targeting as an exception
  5. Explicit depends_on for side effects

Explanation

Correct Answer

E:

The depends_on meta-argument is suitable when a real dependency exists but no normal expression reference conveys it; this directly meets the requirement to order a resource after a prerequisite that has no referenced attribute. By comparison, terraform_data as a replacement trigger is intended to trigger replacement from a plain variable value change, which is a different task from order a resource after a prerequisite that has no referenced attribute.

Incorrect Answers

A:

The lifecycle ignore_changes list excludes chosen attributes from later update comparisons while creation still considers configured values; this mechanism is useful when the job is to allow another system to update selected attributes without Terraform reverting them, whereas the current scenario requires the engineer to order a resource after a prerequisite that has no referenced attribute. These operations have different effects in the stated Terraform workflow.

B:

A terraform_data resource can expose input-related lifecycle actions for replace_triggered_by, which expects managed resource changes; this mechanism is useful when the job is to trigger replacement from a plain variable value change, whereas the current scenario requires the engineer to order a resource after a prerequisite that has no referenced attribute. These operations have different effects in the stated Terraform workflow.

C:

With all attributes ignored during updates, Terraform can still create and destroy the resource but does not reconcile field-level changes; this mechanism is useful when the job is to disable updates to all managed resource attributes after creation, whereas the current scenario requires the engineer to order a resource after a prerequisite that has no referenced attribute. These operations have different effects in the stated Terraform workflow.

D:

The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model; this mechanism is useful when the job is to repair an isolated broken dependency while acknowledging incomplete plan coverage, whereas the current scenario requires the engineer to order a resource after a prerequisite that has no referenced attribute. These operations have different effects in the stated Terraform workflow.

Question 489

During a design review, the requirement is to reject caller values that cannot satisfy the declared input type. Which option should the engineer select?

  1. The variable type argument
  2. terraform output -raw
  3. The -var-file option
  4. A sensitive output

Explanation

Correct Answer

A:

A variable's type constraint enforces the intended structure and allows appropriate Terraform type conversions; this directly meets the requirement to reject caller values that cannot satisfy the declared input type. By comparison, the -var-file option is intended to load a nonstandard variable file selected for one environment, which is a different task from reject caller values that cannot satisfy the declared input type.

Incorrect Answers

B:

The -raw output mode prints a single string, number or boolean value in a script-friendly form and may reveal sensitive data; this mechanism is useful when the job is to extract a primitive output without the surrounding formatted representation, whereas the current scenario requires the engineer to reject caller values that cannot satisfy the declared input type. These operations have different effects in the stated Terraform workflow.

C:

The -var-file flag explicitly selects a variables file rather than relying on auto-loaded naming conventions; this mechanism is useful when the job is to load a nonstandard variable file selected for one environment, whereas the current scenario requires the engineer to reject caller values that cannot satisfy the declared input type. These operations have different effects in the stated Terraform workflow.

D:

Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state; this mechanism is useful when the job is to hide a secret-like output from Terraform's usual human-readable display, whereas the current scenario requires the engineer to reject caller values that cannot satisfy the declared input type. These operations have different effects in the stated Terraform workflow.

Question 490

During a design review, the requirement is to determine a module's declared inputs, outputs, providers and usage examples. Which option should the engineer select?

  1. terraform get
  2. An absolute local module source
  3. A Git HTTPS module source
  4. Registry module documentation

Explanation

Correct Answer

D:

Published module documentation and metadata describe the module interface and help consumers understand required arguments; this directly meets the requirement to determine a module's declared inputs, outputs, providers and usage examples. 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 determine a module's declared inputs, outputs, providers and usage examples.

Incorrect Answers

A:

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 determine a module's declared inputs, outputs, providers and usage examples. These operations have different effects in the stated Terraform workflow.

B:

Terraform can load a module from a local filesystem path, though absolute paths make configurations less portable; this mechanism is useful when the job is to call a child module from an explicit filesystem path, whereas the current scenario requires the engineer to determine a module's declared inputs, outputs, providers and usage examples. These operations have different effects in the stated Terraform workflow.

C:

A git::https:// source can retrieve a Terraform module from version control rather than from the module registry; this mechanism is useful when the job is to fetch module code directly from a remote Git repository, whereas the current scenario requires the engineer to determine a module's declared inputs, outputs, providers and usage examples. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests