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

Question 620

An engineer intends to make a subnet wait for the network resource it references and is reviewing “An implicit dependency through an ID”. What consequence follows from using it as intended?

  1. The lifecycle rule prevents destruction or replacement while it remains declared on the resource; removing its block removes that protection.
  2. The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model.
  3. A terraform_data resource can expose input-related lifecycle actions for replace_triggered_by, which expects managed resource changes.
  4. Using the network object's ID in the subnet argument automatically creates a dependency edge in the graph.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to make a subnet wait for the network resource it references, so it produces the behavior described. In contrast, terraform_data as a replacement trigger serves a different goal: trigger replacement from a plain variable value change, not make a subnet wait for the network resource it references.

Incorrect Answers

A:

The description applies to prevent_destroy when an engineer needs to reject an execution plan that deletes a protected configured object; the named an implicit dependency through an ID instead handles the requirement to make a subnet wait for the network resource it references, so this behavior does not describe An implicit dependency through an ID in the situation named.

B:

The description applies to resource targeting as an exception when an engineer needs to repair an isolated broken dependency while acknowledging incomplete plan coverage; the named an implicit dependency through an ID instead handles the requirement to make a subnet wait for the network resource it references, so this behavior does not describe An implicit dependency through an ID in the situation named.

C:

The description applies to terraform_data as a replacement trigger when an engineer needs to trigger replacement from a plain variable value change; the named an implicit dependency through an ID instead handles the requirement to make a subnet wait for the network resource it references, so this behavior does not describe An implicit dependency through an ID in the situation named.

Question 621

A Terraform change proposal names “The .terraform directory” to identify where a working directory keeps installed modules and initialization metadata. Which outcome can reviewers attribute to that particular mechanism?

  1. This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets.
  2. Upgrade tells init to reconsider prior module selections instead of simply reusing previously installed versions.
  3. The migrate-state flag attempts to copy prior state into the new backend and can prompt for migration confirmation.
  4. Terraform creates .terraform for module caches, provider installations and backend/workspace metadata; it is not a substitute for committed configuration.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to identify where a working directory keeps installed modules and initialization metadata, so it produces the behavior described. In contrast, terraform init -migrate-state serves a different goal: move existing state to a newly configured backend, not identify where a working directory keeps installed modules and initialization metadata.

Incorrect Answers

A:

The description applies to terraform init -backend-config when an engineer needs to inject partial backend settings at initialization time; the named the .terraform directory instead handles the requirement to identify where a working directory keeps installed modules and initialization metadata, so this behavior does not describe The .terraform directory in the situation named.

B:

The description applies to terraform init -upgrade for modules when an engineer needs to fetch newer module releases permitted by version constraints; the named the .terraform directory instead handles the requirement to identify where a working directory keeps installed modules and initialization metadata, so this behavior does not describe The .terraform directory in the situation named.

C:

The description applies to terraform init -migrate-state when an engineer needs to move existing state to a newly configured backend; the named the .terraform directory instead handles the requirement to identify where a working directory keeps installed modules and initialization metadata, so this behavior does not describe The .terraform directory in the situation named.

Question 622

The team evaluates “terraform validate” for a requirement to check that Terraform configuration is structurally valid without planning resource changes. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. The fmt -check option exits with a failure status when source files would need formatting changes rather than altering them.
  2. The validate command checks syntax and schema consistency in an initialized configuration without obtaining a full execution plan.
  3. Because validate consults provider and module definitions, run init first to install referenced dependencies.
  4. The Terraform test command executes defined test runs and assertions, which can exercise behavior beyond basic configuration validation.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to check that Terraform configuration is structurally valid without planning resource changes, so it produces the behavior described. In contrast, terraform fmt -check serves a different goal: verify formatting without rewriting the files in a CI job, not check that Terraform configuration is structurally valid without planning resource changes.

Incorrect Answers

A:

The description applies to terraform fmt -check when an engineer needs to verify formatting without rewriting the files in a CI job; the named terraform validate instead handles the requirement to check that Terraform configuration is structurally valid without planning resource changes, so this behavior does not describe terraform validate in the situation named.

C:

The description applies to validate after init when an engineer needs to resolve missing provider schemas before checking configuration; the named terraform validate instead handles the requirement to check that Terraform configuration is structurally valid without planning resource changes, so this behavior does not describe terraform validate in the situation named.

D:

The description applies to terraform test when an engineer needs to run declarative module tests instead of only checking syntax; the named terraform validate instead handles the requirement to check that Terraform configuration is structurally valid without planning resource changes, so this behavior does not describe terraform validate in the situation named.

Question 623

During an infrastructure design review about how to retrieve a published plugin from its declared registry source, a maintainer asks what “Provider registry installation” does. Which description is accurate?

  1. Terraform uses provider source metadata and its configured installation methods to find and install the appropriate plugin binary.
  2. The pessimistic constraint ~> 5.3 permits version 5.3 and later releases below 6.0.0.
  3. The pessimistic constraint ~> 5.3.0 admits versions at least 5.3.0 but below 5.4.0.
  4. The .terraform.lock.hcl file records selected provider versions and checksums to constrain subsequent installations.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to retrieve a published plugin from its declared registry source, so it produces the behavior described. In contrast, a compatible provider constraint serves a different goal: accept patch updates within a chosen minor line, not retrieve a published plugin from its declared registry source.

Incorrect Answers

B:

The description applies to a major-series compatible constraint when an engineer needs to accept minor and patch updates without crossing the next major version; the named provider registry installation instead handles the requirement to retrieve a published plugin from its declared registry source, so this behavior does not describe Provider registry installation in the situation named.

C:

The description applies to a compatible provider constraint when an engineer needs to accept patch updates within a chosen minor line; the named provider registry installation instead handles the requirement to retrieve a published plugin from its declared registry source, so this behavior does not describe Provider registry installation in the situation named.

D:

The description applies to the dependency lock file when an engineer needs to reproduce previously selected provider package versions on other machines; the named provider registry installation instead handles the requirement to retrieve a published plugin from its declared registry source, so this behavior does not describe Provider registry installation in the situation named.

Question 624

During a design review, the requirement is to run Terraform in a private network where hosted workers cannot reach internal endpoints. Which option should the engineer select?

  1. HCP Terraform execution agents
  2. A CLI-driven workspace
  3. A VCS-connected workspace
  4. A run apply phase
  5. The HCP run queue

Explanation

Correct Answer

A:

HCP Terraform agents can execute runs in customer-controlled networking while integrating with service orchestration; this directly meets the requirement to run Terraform in a private network where hosted workers cannot reach internal endpoints. By comparison, the HCP run queue is intended to coordinate multiple requested changes against the same workspace state, which is a different task from run Terraform in a private network where hosted workers cannot reach internal endpoints.

Incorrect Answers

B:

A CLI workflow can send configuration from the Terraform CLI to HCP Terraform for workspace runs; this mechanism is useful when the job is to upload local configuration for execution through HCP Terraform rather than relying on Git webhooks, whereas the current scenario requires the engineer to run Terraform in a private network where hosted workers cannot reach internal endpoints. These operations have different effects in the stated Terraform workflow.

C:

HCP Terraform can connect a workspace to a VCS repository and create runs when relevant commits are pushed; this mechanism is useful when the job is to trigger infrastructure runs from changes in a configured version-control repository, whereas the current scenario requires the engineer to run Terraform in a private network where hosted workers cannot reach internal endpoints. These operations have different effects in the stated Terraform workflow.

D:

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 run Terraform in a private network where hosted workers cannot reach internal endpoints. These operations have different effects in the stated Terraform workflow.

E:

Queued runs and workspace run management help serialize changes and avoid competing applies to one state; this mechanism is useful when the job is to coordinate multiple requested changes against the same workspace state, whereas the current scenario requires the engineer to run Terraform in a private network where hosted workers cannot reach internal endpoints. These operations have different effects in the stated Terraform workflow.

Question 625

A change request asks an engineer to share approved modules with organization members without relying on public registry visibility. Which choice best implements the requested behavior?

  1. Workspace audit history
  2. Policy sets
  3. Project-based permission boundaries
  4. Cost estimation
  5. The HCP private module registry

Explanation

Correct Answer

E:

Private registry modules can be published, versioned and discovered by authorized HCP Terraform users; this directly meets the requirement to share approved modules with organization members without relying on public registry visibility. By comparison, cost estimation is intended to preview an estimated cost impact of planned infrastructure changes when available, which is a different task from share approved modules with organization members without relying on public registry visibility.

Incorrect Answers

A:

Run history records plan and apply activity to support team review and change tracking; this mechanism is useful when the job is to review past runs and changes in a shared HCP organization, whereas the current scenario requires the engineer to share approved modules with organization members without relying on public registry visibility. These operations have different effects in the stated Terraform workflow.

B:

Policy sets organize policy rules and their workspace or project applicability rather than modifying provider schemas directly; this mechanism is useful when the job is to attach a shared governance policy collection to selected workspace scopes, whereas the current scenario requires the engineer to share approved modules with organization members without relying on public registry visibility. These operations have different effects in the stated Terraform workflow.

C:

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 share approved modules with organization members without relying on public registry visibility. These operations have different effects in the stated Terraform workflow.

D:

HCP Terraform can estimate resource costs for supported providers and resources before apply; estimates are not invoices; this mechanism is useful when the job is to preview an estimated cost impact of planned infrastructure changes when available, whereas the current scenario requires the engineer to share approved modules with organization members without relying on public registry visibility. These operations have different effects in the stated Terraform workflow.

Question 626

A module publishing and release workflow has a concrete implementation goal: share reusable Terraform configuration with multiple root projects. What is the most appropriate Terraform mechanism?

  1. A public registry module source
  2. terraform get
  3. Registry module documentation
  4. A separate module repository

Explanation

Correct Answer

D:

Keeping reusable child modules separately versioned allows independent adoption and maintenance by different Terraform root modules; this directly meets the requirement to share reusable Terraform configuration with multiple root projects. By comparison, registry module documentation is intended to determine a module's declared inputs, outputs, providers and usage examples, which is a different task from share reusable Terraform configuration with multiple root projects.

Incorrect Answers

A:

Registry module sources use the namespace/name/provider address form and can support a separate version argument; this mechanism is useful when the job is to download a community module published with an official registry address, whereas the current scenario requires the engineer to share reusable Terraform configuration with multiple root projects. These operations have different effects in the stated Terraform workflow.

B:

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 share reusable Terraform configuration with multiple root projects. These operations have different effects in the stated Terraform workflow.

C:

Published module documentation and metadata describe the module interface and help consumers understand required arguments; this mechanism is useful when the job is to determine a module's declared inputs, outputs, providers and usage examples, whereas the current scenario requires the engineer to share reusable Terraform configuration with multiple root projects. These operations have different effects in the stated Terraform workflow.

Question 627

A Terraform reviewer encounters “An auto-loaded .auto.tfvars file” while assessing how to apply extra variable assignments without adding a command-line flag. Which statement correctly describes its actual behavior?

  1. The default argument supplies a value when the caller provides no other assignment for that variable.
  2. Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state.
  3. Validation uses a condition expression and error_message to provide a tailored error when the supplied input is unacceptable.
  4. Files ending in .auto.tfvars or .auto.tfvars.json are automatically loaded as root-module input values.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to apply extra variable assignments without adding a command-line flag, so it produces the behavior described. In contrast, a variable validation block serves a different goal: reject an input value that violates an explicit business rule, not apply extra variable assignments without adding a command-line flag.

Incorrect Answers

A:

The description applies to a variable default value when an engineer needs to make a module input optional for callers using a common baseline; the named an auto-loaded .auto.tfvars file instead handles the requirement to apply extra variable assignments without adding a command-line flag, so this behavior does not describe An auto-loaded .auto.tfvars file in the situation named.

B:

The description applies to a sensitive output when an engineer needs to hide a secret-like output from Terraform's usual human-readable display; the named an auto-loaded .auto.tfvars file instead handles the requirement to apply extra variable assignments without adding a command-line flag, so this behavior does not describe An auto-loaded .auto.tfvars file in the situation named.

C:

The description applies to a variable validation block when an engineer needs to reject an input value that violates an explicit business rule; the named an auto-loaded .auto.tfvars file instead handles the requirement to apply extra variable assignments without adding a command-line flag, so this behavior does not describe An auto-loaded .auto.tfvars file in the situation named.

Question 628

An engineer intends to select between two expression results based on a boolean predicate and is reviewing “A conditional expression”. What consequence follows from using it as intended?

  1. Terraform's condition ? true_value : false_value syntax chooses one branch while reconciling compatible result types.
  2. toset converts a collection into a set; duplicate elements are removed and original positional ordering is not preserved.
  3. A resource's for_each meta-argument accepts maps or sets of strings; map keys appear in resource addresses.
  4. The type constraint list(string) represents ordered string elements and supports numeric indexing, preserving element order.
  5. The map(string) type models uniform values accessed by key rather than by positional index.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to select between two expression results based on a boolean predicate, so it produces the behavior described. In contrast, a map of strings type serves a different goal: associate arbitrary string keys with string values, not select between two expression results based on a boolean predicate.

Incorrect Answers

B:

The description applies to toset conversion when an engineer needs to deduplicate a collection of string identifiers for keyed iteration; the named a conditional expression instead handles the requirement to select between two expression results based on a boolean predicate, so this behavior does not describe A conditional expression in the situation named.

C:

The description applies to for_each with a map when an engineer needs to create instances using stable logical keys rather than shifting numeric indexes; the named a conditional expression instead handles the requirement to select between two expression results based on a boolean predicate, so this behavior does not describe A conditional expression in the situation named.

D:

The description applies to a list of strings type when an engineer needs to accept an ordered collection of same-type string values; the named a conditional expression instead handles the requirement to select between two expression results based on a boolean predicate, so this behavior does not describe A conditional expression in the situation named.

E:

The description applies to a map of strings type when an engineer needs to associate arbitrary string keys with string values; the named a conditional expression instead handles the requirement to select between two expression results based on a boolean predicate, so this behavior does not describe A conditional expression in the situation named.

Question 629

A root module wires one child module output into a different child module input, establishing a declared interface and value dependency. Which design pattern best describes the connection between the two modules?

  1. A module dependency interface
  2. Avoiding hard-coded child credentials
  3. Multiple calls to one module
  4. A module call block

Explanation

Correct Answer

A:

An output-to-input reference establishes a natural dependency and avoids imposing broad depends_on edges unnecessarily; this directly meets the requirement to connect two modules by declared output and input values. By comparison, a module output reference is intended to use a network module's subnet IDs inside an application module call, which is a different task from connect two modules by declared output and input values.

Incorrect Answers

B:

Reusable modules normally declare provider requirements while callers supply provider configurations and credentials; this mechanism is useful when the job is to keep authentication and deployment-specific region choices outside a reusable child module, whereas the current scenario requires the engineer to connect two modules by declared output and input values. These operations have different effects in the stated Terraform workflow.

C:

Two module blocks that use the same source create separate module instances and separate resource addresses; this concerns the task to deploy two independently managed stacks from the same module definition, not the current need to connect two modules by declared output and input values. A A module dependency interface approach is appropriate here; the substituted Multiple calls to one module option does not supply the specified Terraform capability.

D:

The module block's source points to child configuration and its other arguments supply input variables and relevant meta-arguments; this mechanism is useful when the job is to instantiate a reusable configuration unit under a distinct local name, whereas the current scenario requires the engineer to connect two modules by declared output and input values. These operations have different effects in the stated Terraform workflow.

Question 630

During a design review, the requirement is to focus verbose diagnostics on Terraform Core rather than all plugin activity. Which option should the engineer select?

  1. TF_LOG=DEBUG
  2. TF_LOG=TRACE
  3. TF_LOG_CORE
  4. Redacting shared diagnostic logs
  5. TF_LOG=INFO

Explanation

Correct Answer

C:

The TF_LOG_CORE variable can control log verbosity for Core messages independently of general logging; this directly meets the requirement to focus verbose diagnostics on Terraform Core rather than all plugin activity. By comparison, TF_LOG=TRACE is intended to obtain detailed Terraform core and provider diagnostic output while troubleshooting, which is a different task from focus verbose diagnostics on Terraform Core rather than all plugin activity.

Incorrect Answers

A:

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 focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

B:

Terraform logging set to TRACE emits highly verbose diagnostic detail and may contain sensitive information; this mechanism is useful when the job is to obtain detailed Terraform core and provider diagnostic output while troubleshooting, whereas the current scenario requires the engineer to focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

D:

Terraform diagnostic logs can include sensitive data, so access control and careful review are required before sharing them; this mechanism is useful when the job is to prevent troubleshooting output from leaking credentials or resource attributes, whereas the current scenario requires the engineer to focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

E:

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 focus verbose diagnostics on Terraform Core rather than all plugin activity. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests