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

Question 450

A runbook lists “No secrets in version control” for the task to keep API keys out of committed terraform.tfvars and .tf files. Which technical effect should its description include?

  1. Saved plan files may contain sensitive values and must be handled as confidential artifacts rather than safe public summaries.
  2. Providers can often authenticate through environment variables or identity integrations so credentials are absent from checked-in HCL.
  3. Vault can centralize secret lifecycle, policies and auditability, but provider and state-handling choices still determine whether a retrieved value is persisted.
  4. Secrets inserted directly into tracked configuration can leak through repository history, regardless of later state redaction.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to keep API keys out of committed terraform.tfvars and .tf files, so it produces the behavior described. In contrast, vault-backed secret retrieval serves a different goal: retrieve an operational credential from a dedicated secret manager rather than committing it, not keep API keys out of committed terraform.tfvars and .tf files.

Incorrect Answers

A:

The description applies to preventing credential leaks in plans when an engineer needs to avoid sharing a plan artifact publicly just because console values appear redacted; the named no secrets in version control instead handles the requirement to keep API keys out of committed terraform.tfvars and .tf files, so this behavior does not describe No secrets in version control in the situation named.

B:

The description applies to environment-based provider credentials when an engineer needs to avoid putting provider access tokens directly in configuration source; the named no secrets in version control instead handles the requirement to keep API keys out of committed terraform.tfvars and .tf files, so this behavior does not describe No secrets in version control in the situation named.

C:

The description applies to vault-backed secret retrieval when an engineer needs to retrieve an operational credential from a dedicated secret manager rather than committing it; the named no secrets in version control instead handles the requirement to keep API keys out of committed terraform.tfvars and .tf files, so this behavior does not describe No secrets in version control in the situation named.

Question 451

A Terraform change proposal names “Plan-before-apply reviews” to see intended infrastructure changes without immediately creating them. Which outcome can reviewers attribute to that particular mechanism?

  1. Version control and run history provide traceable context for what configuration changed and what Terraform planned or applied.
  2. With no configuration or remote drift requiring action, a new plan normally proposes no infrastructure changes.
  3. A Terraform plan is a reviewable proposed set of actions; execution occurs only when an apply runs against the chosen plan.
  4. Terraform can refresh managed objects during planning and flag differences between the observed infrastructure and configuration.
  5. A version-control pull request can expose infrastructure edits to peer review, policy checks and automated validation.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to see intended infrastructure changes without immediately creating them, so it produces the behavior described. In contrast, drift detection during planning serves a different goal: notice remote infrastructure changes made outside Terraform, not see intended infrastructure changes without immediately creating them.

Incorrect Answers

A:

The description applies to reusable execution records when an engineer needs to audit the results of infrastructure changes across a team; the named plan-before-apply reviews instead handles the requirement to see intended infrastructure changes without immediately creating them, so this behavior does not describe Plan-before-apply reviews in the situation named.

B:

The description applies to idempotent convergence when an engineer needs to run unchanged configuration repeatedly without inventing new infrastructure updates; the named plan-before-apply reviews instead handles the requirement to see intended infrastructure changes without immediately creating them, so this behavior does not describe Plan-before-apply reviews in the situation named.

D:

The description applies to drift detection during planning when an engineer needs to notice remote infrastructure changes made outside Terraform; the named plan-before-apply reviews instead handles the requirement to see intended infrastructure changes without immediately creating them, so this behavior does not describe Plan-before-apply reviews in the situation named.

E:

The description applies to code review of infrastructure when an engineer needs to catch undesirable configuration changes before deployment; the named plan-before-apply reviews instead handles the requirement to see intended infrastructure changes without immediately creating them, so this behavior does not describe Plan-before-apply reviews in the situation named.

Question 452

A cloud engineering team using managed Terraform runs requires a way to supply a configuration input or environment value for HCP Terraform runs. Which Terraform approach most directly fulfills that request?

  1. HCP Terraform execution agents
  2. A run plan phase
  3. A run apply phase
  4. A workspace variable

Explanation

Correct Answer

D:

HCP Terraform workspaces can hold Terraform input variables and environment variables for run-time use; this directly meets the requirement to supply a configuration input or environment value for HCP Terraform runs. By comparison, a run apply phase is intended to execute approved resource changes within an HCP Terraform workspace, which is a different task from supply a configuration input or environment value for HCP Terraform runs.

Incorrect Answers

A:

HCP Terraform agents can execute runs in customer-controlled networking while integrating with service orchestration; this mechanism is useful when the job is to run Terraform in a private network where hosted workers cannot reach internal endpoints, whereas the current scenario requires the engineer to supply a configuration input or environment value for HCP Terraform runs. These operations have different effects in the stated Terraform workflow.

B:

HCP Terraform runs have plan stages where proposed infrastructure operations can be inspected and checked; this mechanism is useful when the job is to review infrastructure differences before applying a workspace change, whereas the current scenario requires the engineer to supply a configuration input or environment value for HCP Terraform runs. These operations have different effects in the stated Terraform workflow.

C:

HCP Terraform can run the apply stage after its configured approval, policy and workflow requirements are satisfied; this mechanism is useful when the job is to execute approved resource changes within an HCP Terraform workspace, whereas the current scenario requires the engineer to supply a configuration input or environment value for HCP Terraform runs. These operations have different effects in the stated Terraform workflow.

Question 453

A team onboarding previously deployed infrastructure needs to prevent troubleshooting output from leaking credentials or resource attributes. Which feature or operation is the most direct match?

  1. Verbose logging only during diagnosis
  2. TF_LOG=DEBUG
  3. Redacting shared diagnostic logs
  4. TF_LOG_CORE

Explanation

Correct Answer

C:

Terraform diagnostic logs can include sensitive data, so access control and careful review are required before sharing them; this directly meets the requirement to prevent troubleshooting output from leaking credentials or resource attributes. By comparison, verbose logging only during diagnosis is intended to avoid permanent trace logs in normal automated runs, which is a different task from prevent troubleshooting output from leaking credentials or resource attributes.

Incorrect Answers

A:

High verbosity creates large logs and greater secret-exposure risk; enable it for a specific incident and disable it afterward; this mechanism is useful when the job is to avoid permanent trace logs in normal automated runs, whereas the current scenario requires the engineer to prevent troubleshooting output from leaking credentials or resource attributes. These operations have different effects in the stated Terraform workflow.

B:

Setting TF_LOG to DEBUG exposes useful troubleshooting messages without the full trace-level volume; this mechanism is useful when the job is to enable diagnostic output with lower verbosity than TRACE, whereas the current scenario requires the engineer to prevent troubleshooting output from leaking credentials or resource attributes. These operations have different effects in the stated Terraform workflow.

D:

The TF_LOG_CORE variable can control log verbosity for Core messages independently of general logging; this mechanism is useful when the job is to focus verbose diagnostics on Terraform Core rather than all plugin activity, whereas the current scenario requires the engineer to prevent troubleshooting output from leaking credentials or resource attributes. These operations have different effects in the stated Terraform workflow.

Question 454

A configuration review for an application stack requires a way to require a fixed sequence of potentially different element types. Which Terraform approach most directly fulfills that request?

  1. The null value
  2. Avoiding index churn with for_each
  3. for_each with a map
  4. A tuple type

Explanation

Correct Answer

D:

tuple([string, number]) enforces a position-specific sequence with different type constraints; this directly meets the requirement to require a fixed sequence of potentially different element types. By comparison, the null value is intended to represent the absence of an optional argument value, which is a different task from require a fixed sequence of potentially different element types.

Incorrect Answers

A:

In supported contexts, setting an optional resource argument to null behaves like leaving that argument unset; this mechanism is useful when the job is to represent the absence of an optional argument value, whereas the current scenario requires the engineer to require a fixed sequence of potentially different element types. These operations have different effects in the stated Terraform workflow.

B:

Keyed for_each instances use stable identifiers, whereas count indexes can shift when list elements are deleted; this mechanism is useful when the job is to preserve instance identity when a middle collection item is removed, whereas the current scenario requires the engineer to require a fixed sequence of potentially different element types. These operations have different effects in the stated Terraform workflow.

C:

A resource's for_each meta-argument accepts maps or sets of strings; map keys appear in resource addresses; this mechanism is useful when the job is to create instances using stable logical keys rather than shifting numeric indexes, whereas the current scenario requires the engineer to require a fixed sequence of potentially different element types. These operations have different effects in the stated Terraform workflow.

Question 455

A Terraform operations troubleshooting session requires a way to correct provider-generated HCL rather than trusting every inferred argument. Which Terraform approach most directly fulfills that request?

  1. Provider permissions during import
  2. A post-import plan
  3. Separate resources for separate imports
  4. An import configuration review
  5. Importing without creating new infrastructure
  6. An import block's to argument

Explanation

Correct Answer

D:

Generated resource declarations are a starting point and can include computed or unsuitable attributes requiring manual cleanup; this directly meets the requirement to correct provider-generated HCL rather than trusting every inferred argument. By comparison, separate resources for separate imports is intended to avoid attaching two remote objects to the same Terraform resource address, which is a different task from correct provider-generated HCL rather than trusting every inferred argument.

Incorrect Answers

A:

Import needs correct provider authentication and sufficient access to query the target resource using its provider-defined import ID; this mechanism is useful when the job is to read an existing cloud object so Terraform can associate it with state, whereas the current scenario requires the engineer to correct provider-generated HCL rather than trusting every inferred argument. These operations have different effects in the stated Terraform workflow.

B:

After import, planning reveals mismatches between the declared resource arguments and the discovered remote object's attributes; this mechanism is useful when the job is to review whether Terraform intends to change imported infrastructure unexpectedly, whereas the current scenario requires the engineer to correct provider-generated HCL rather than trusting every inferred argument. These operations have different effects in the stated Terraform workflow.

C:

Each managed remote object should have its own appropriate resource instance address so state can map objects unambiguously; this mechanism is useful when the job is to avoid attaching two remote objects to the same Terraform resource address, whereas the current scenario requires the engineer to correct provider-generated HCL rather than trusting every inferred argument. These operations have different effects in the stated Terraform workflow.

E:

The import workflow adds an existing remote object to state and can manage it through later plans instead of creating a replacement automatically; this mechanism is useful when the job is to take ownership of an existing object rather than duplicating it, whereas the current scenario requires the engineer to correct provider-generated HCL rather than trusting every inferred argument. These operations have different effects in the stated Terraform workflow.

F:

The to argument points to an intended Terraform resource address rather than a provider account name or state backend; this mechanism is useful when the job is to specify which resource instance address should receive the imported object, whereas the current scenario requires the engineer to correct provider-generated HCL rather than trusting every inferred argument. These operations have different effects in the stated Terraform workflow.

Question 456

The team evaluates “A strict registry module pin” for a requirement to reproduce a vetted module release without automatically selecting a newer one. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. A module version constraint such as = 2.1.3 selects only that published version until the requirement changes.
  2. A module upgrade can change resource definitions and outputs, so the consumer should inspect the new source and resulting Terraform plan.
  3. Changing a module source or version constraint requires reinitializing to resolve the updated selection.
  4. A module version ~> 2.1.0 permits 2.1.x releases but excludes 2.2.0 and later.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to reproduce a vetted module release without automatically selecting a newer one, so it produces the behavior described. In contrast, a pessimistic module version constraint serves a different goal: allow compatible patch updates within a module's minor release series, not reproduce a vetted module release without automatically selecting a newer one.

Incorrect Answers

B:

The description applies to reviewing module upgrade changes when an engineer needs to control behavioral changes after moving to a new module release; the named a strict registry module pin instead handles the requirement to reproduce a vetted module release without automatically selecting a newer one, so this behavior does not describe A strict registry module pin in the situation named.

C:

The description applies to init after module version change when an engineer needs to install a newly allowed child module release after editing its version requirement; the named a strict registry module pin instead handles the requirement to reproduce a vetted module release without automatically selecting a newer one, so this behavior does not describe A strict registry module pin in the situation named.

D:

The description applies to a pessimistic module version constraint when an engineer needs to allow compatible patch updates within a module's minor release series; the named a strict registry module pin instead handles the requirement to reproduce a vetted module release without automatically selecting a newer one, so this behavior does not describe A strict registry module pin in the situation named.

Question 457

A team proposes “Different values for two module calls” to read command-line and tfvars input values for the root module. If they proceed with that technique, which result should they anticipate instead?

  1. Root variables accept runtime assignments, whereas a child module normally receives its inputs through the parent's module call.
  2. Each call has its own variable assignments and resource instances, even when both calls reference the same module source directory.
  3. The output block defines a published module interface; the parent reads the value as module.NAME.OUTPUT.
  4. Locals live within the module where defined and cannot be referenced from another module without passing or exposing a value.

Explanation

Correct Answer

B:

Different values for two module calls is used when an operator needs to instantiate the same module with distinct environment inputs. Consequently, this choice cannot meet the separate requirement to read command-line and tfvars input values for the root module. The intended action would instead require Root input variable scope.

Incorrect Answers

A:

That outcome belongs to Root input variable scope, the mechanism that can read command-line and tfvars input values for the root module. The question concerns the engineer’s actual proposal, Different values for two module calls; it is directed at instantiate the same module with distinct environment inputs, not that result.

C:

This behavior belongs to A child module output, which helps engineers expose a chosen internal attribute to the calling parent module rather than satisfying the separate requirement to read command-line and tfvars input values for the root module. The attempted technique was Different values for two module calls; it would instead be used to instantiate the same module with distinct environment inputs, not to produce the effect associated with A child module output.

D:

This behavior belongs to A local value confined to its module, which helps engineers avoid assuming a local calculation is automatically visible in a parent module rather than satisfying the separate requirement to read command-line and tfvars input values for the root module. The attempted technique was Different values for two module calls; it would instead be used to instantiate the same module with distinct environment inputs, not to produce the effect associated with A local value confined to its module.

Question 458

A Terraform reviewer encounters “A separate module repository” while assessing how to share reusable Terraform configuration with multiple root projects. Which statement correctly describes its actual behavior?

  1. Registry module sources use the namespace/name/provider address form and can support a separate version argument.
  2. A module source such as ./modules/network points to a local directory and requires no registry download or semantic version selection.
  3. A git::https:// source can retrieve a Terraform module from version control rather than from the module registry.
  4. Keeping reusable child modules separately versioned allows independent adoption and maintenance by different Terraform root modules.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to share reusable Terraform configuration with multiple root projects, so it produces the behavior described. In contrast, a Git HTTPS module source serves a different goal: fetch module code directly from a remote Git repository, not share reusable Terraform configuration with multiple root projects.

Incorrect Answers

A:

The description applies to a public registry module source when an engineer needs to download a community module published with an official registry address; the named a separate module repository instead handles the requirement to share reusable Terraform configuration with multiple root projects, so this behavior does not describe A separate module repository in the situation named.

B:

The description applies to a relative local module source when an engineer needs to reuse a neighboring module directory in the same repository; the named a separate module repository instead handles the requirement to share reusable Terraform configuration with multiple root projects, so this behavior does not describe A separate module repository in the situation named.

C:

The description applies to a Git HTTPS module source when an engineer needs to fetch module code directly from a remote Git repository; the named a separate module repository instead handles the requirement to share reusable Terraform configuration with multiple root projects, so this behavior does not describe A separate module repository in the situation named.

Question 459

During a design review, the requirement is to define a specific boolean statement for a nonblocking Terraform health check. Which option should the engineer select?

  1. Custom conditions with unknown values
  2. An assert block inside check
  3. terraform validate versus runtime assertions
  4. Preconditions for external assumptions

Explanation

Correct Answer

B:

Check blocks contain assert blocks with condition and error_message to describe an unsuccessful assertion; this directly meets the requirement to define a specific boolean statement for a nonblocking Terraform health check. By comparison, terraform validate versus runtime assertions is intended to distinguish static configuration checks from conditions requiring actual resource values, which is a different task from define a specific boolean statement for a nonblocking Terraform health check.

Incorrect Answers

A:

Terraform may defer condition evaluation to apply when required expression values are unknown during planning; this mechanism is useful when the job is to understand when a validation cannot yet be decided at planning time, whereas the current scenario requires the engineer to define a specific boolean statement for a nonblocking Terraform health check. These operations have different effects in the stated Terraform workflow.

C:

Static validate checks structural correctness, while condition expressions may depend on inputs or provider readings evaluated during plan or apply; this mechanism is useful when the job is to distinguish static configuration checks from conditions requiring actual resource values, whereas the current scenario requires the engineer to define a specific boolean statement for a nonblocking Terraform health check. These operations have different effects in the stated Terraform workflow.

D:

A precondition can express a domain requirement such as a selected image having an expected property before using it; this mechanism is useful when the job is to guard a resource against prerequisites outside the provider's basic schema, whereas the current scenario requires the engineer to define a specific boolean statement for a nonblocking Terraform health check. These operations have different effects in the stated Terraform workflow.

Question 460

A Terraform runbook prescribes “Remote state sharing boundaries” to preserve Terraform's knowledge of managed infrastructure between CLI runs, but it does not meet the requirement. What does that step actually accomplish?

  1. State can retain dependency information needed to correctly destroy objects no longer declared in configuration.
  2. The state snapshot records managed instance data and metadata needed to plan future actions.
  3. Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure.
  4. State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter.

Explanation

Correct Answer

C:

Remote state sharing boundaries is used when an operator needs to avoid exposing full state when another stack only needs a published identifier. Consequently, this choice cannot meet the separate requirement to preserve Terraform's knowledge of managed infrastructure between CLI runs. The intended action would instead require State snapshots.

Incorrect Answers

A:

This behavior belongs to State-backed dependency links, which helps engineers maintain dependencies for resources that have been removed from configuration rather than satisfying the separate requirement to preserve Terraform's knowledge of managed infrastructure between CLI runs. The attempted technique was Remote state sharing boundaries; it would instead be used to avoid exposing full state when another stack only needs a published identifier, not to produce the effect associated with State-backed dependency links.

B:

That outcome belongs to State snapshots, the mechanism that can preserve Terraform's knowledge of managed infrastructure between CLI runs. The question concerns the engineer’s actual proposal, Remote state sharing boundaries; it is directed at avoid exposing full state when another stack only needs a published identifier, not that result.

D:

This behavior belongs to State access protection, which helps engineers treat a Terraform state file as potentially sensitive data rather than satisfying the separate requirement to preserve Terraform's knowledge of managed infrastructure between CLI runs. The attempted technique was Remote state sharing boundaries; it would instead be used to avoid exposing full state when another stack only needs a published identifier, not to produce the effect associated with State access protection.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests