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

Question 570

A new infrastructure-as-code adoption project has a concrete implementation goal: coordinate an on-premises platform with public-cloud resources. What is the most appropriate Terraform mechanism?

  1. Hybrid infrastructure provisioning
  2. Provider-specific capabilities
  3. Integrating platform and DNS configuration
  4. Isolating deployment boundaries

Explanation

Correct Answer

A:

Providers can represent both on-premises platforms and cloud services as Terraform-managed resources in one workflow; this directly meets the requirement to coordinate an on-premises platform with public-cloud resources. By comparison, isolating deployment boundaries is intended to limit the impact of changes to one environment or platform, which is a different task from coordinate an on-premises platform with public-cloud resources.

Incorrect Answers

B:

A shared Terraform language does not erase provider API differences; each provider defines supported resource schemas and behavior; this mechanism is useful when the job is to avoid assuming that all providers expose identical resource types and options, whereas the current scenario requires the engineer to coordinate an on-premises platform with public-cloud resources. These operations have different effects in the stated Terraform workflow.

C:

Distinct providers can manage compute and DNS resources while references communicate values such as an assigned endpoint; this mechanism is useful when the job is to manage a cloud-hosted service and its DNS records declaratively, whereas the current scenario requires the engineer to coordinate an on-premises platform with public-cloud resources. These operations have different effects in the stated Terraform workflow.

D:

Separate root modules and state files reduce shared-plan scope when different teams or lifecycles require isolation; this mechanism is useful when the job is to limit the impact of changes to one environment or platform, whereas the current scenario requires the engineer to coordinate an on-premises platform with public-cloud resources. These operations have different effects in the stated Terraform workflow.

Question 571

During a design review, the requirement is to control which published module release a root configuration consumes. Which option should the engineer select?

  1. A module dependency interface
  2. Using a module registry version
  3. A module root directory
  4. Module provider mappings

Explanation

Correct Answer

B:

The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings; this directly meets the requirement to control which published module release a root configuration consumes. By comparison, a module dependency interface is intended to connect two modules by declared output and input values, which is a different task from control which published module release a root configuration consumes.

Incorrect Answers

A:

An output-to-input reference establishes a natural dependency and avoids imposing broad depends_on edges unnecessarily; this mechanism is useful when the job is to connect two modules by declared output and input values, whereas the current scenario requires the engineer to control which published module release a root configuration consumes. These operations have different effects in the stated Terraform workflow.

C:

All Terraform configuration files in a module directory are combined as one module; filenames do not define separate execution units; this mechanism is useful when the job is to understand which source files Terraform loads as one module, whereas the current scenario requires the engineer to control which published module release a root configuration consumes. These operations have different effects in the stated Terraform workflow.

D:

The providers map on the module call maps child provider names to selected provider configurations from the root module; this mechanism is useful when the job is to send the correct region-specific provider into a reusable child module, whereas the current scenario requires the engineer to control which published module release a root configuration consumes. These operations have different effects in the stated Terraform workflow.

Question 572

A runbook lists “count and depends_on together” for the task to make multiple resource instances wait for a shared prerequisite. Which technical effect should its description include?

  1. With all attributes ignored during updates, Terraform can still create and destroy the resource but does not reconcile field-level changes.
  2. This lifecycle rule uses planned resource actions as triggers for replacement and is not a general-purpose dependency selector.
  3. The depends_on edge can relate the whole counted resource block to an upstream resource, rather than computing one edge by list position.
  4. A terraform_data resource can expose input-related lifecycle actions for replace_triggered_by, which expects managed resource changes.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to make multiple resource instances wait for a shared prerequisite, so it produces the behavior described. In contrast, ignore_changes = all serves a different goal: disable updates to all managed resource attributes after creation, not make multiple resource instances wait for a shared prerequisite.

Incorrect Answers

A:

The description applies to ignore_changes = all when an engineer needs to disable updates to all managed resource attributes after creation; the named count and depends_on together instead handles the requirement to make multiple resource instances wait for a shared prerequisite, so this behavior does not describe count and depends_on together in the situation named.

B:

The description applies to replace_triggered_by when an engineer needs to replace one managed resource when another managed resource's attribute changes; the named count and depends_on together instead handles the requirement to make multiple resource instances wait for a shared prerequisite, so this behavior does not describe count and depends_on together in the situation named.

D:

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 count and depends_on together instead handles the requirement to make multiple resource instances wait for a shared prerequisite, so this behavior does not describe count and depends_on together in the situation named.

Question 573

During an infrastructure design review about how to identify changes between the declared configuration and managed infrastructure, a maintainer asks what “Desired-state reconciliation” does. Which description is accurate?

  1. Planning compares configuration with state and refreshed remote data to propose actions that reconcile differences.
  2. Infrastructure configuration can be committed and reviewed in version control so the intended change is traceable before a Terraform run.
  3. Terraform derives dependency edges from references, using the graph to order dependent changes and permit safe parallel operations.
  4. IaC configuration provides repeatable definitions; variables and isolated state allow environments to differ without independently hand-building each object.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to identify changes between the declared configuration and managed infrastructure, so it produces the behavior described. In contrast, a resource graph serves a different goal: determine a safe sequence for creating objects with references between them, not identify changes between the declared configuration and managed infrastructure.

Incorrect Answers

B:

This describes Version-controlled infrastructure definition and its job to review a proposed infrastructure change before team members deploy it, whereas the question asks about Desired-state reconciliation. The latter is the mechanism used to identify changes between the declared configuration and managed infrastructure; the proposed effect belongs to a different Terraform feature.

C:

The description applies to a resource graph when an engineer needs to determine a safe sequence for creating objects with references between them; the named desired-state reconciliation instead handles the requirement to identify changes between the declared configuration and managed infrastructure, so this behavior does not describe Desired-state reconciliation in the situation named.

D:

The description applies to repeatable environment definition when an engineer needs to recreate the same logical infrastructure design across test and production; the named desired-state reconciliation instead handles the requirement to identify changes between the declared configuration and managed infrastructure, so this behavior does not describe Desired-state reconciliation in the situation named.

Question 574

During one infrastructure delivery, the team must satisfy all of the following: (1) serialize operations that write the same Terraform state; (2) protect a workstation's local state file even when output values are hidden. Select TWO appropriate Terraform approaches. Choose TWO.

  1. A backend state lock
  2. A local backend path setting
  3. terraform plan -lock-timeout
  4. State migration from local storage
  5. State file confidentiality
  6. terraform force-unlock

Explanation

Correct Answers

A:

Supported backends acquire a state lock so simultaneous writers cannot corrupt or overwrite each other's state changes; this meets the requirement to serialize operations that write the same Terraform state, while the other selected techniques address protect a workstation's local state file even when output values are hidden, which require their own distinct Terraform mechanisms.

E:

Local state can hold raw provider attributes and secrets, so filesystem access controls and encryption matter; this meets the requirement to protect a workstation's local state file even when output values are hidden, while the other selected techniques address serialize operations that write the same Terraform state, which require their own distinct Terraform mechanisms.

Incorrect Answers

B:

The local backend supports a path argument for where the state file is stored on disk; it addresses save the default workspace state to a nondefault local filename, but this delivery instead requires serialize operations that write the same Terraform state and protect a workstation's local state file even when output values are hidden. The required combination involves State file confidentiality and A backend state lock, not the behavior of A local backend path setting.

C:

The lock-timeout option lets Terraform retry lock acquisition for a specified duration before returning an error; it addresses wait for a temporary state lock instead of failing immediately, but this delivery instead requires serialize operations that write the same Terraform state and protect a workstation's local state file even when output values are hidden. The required combination involves State file confidentiality and A backend state lock, not the behavior of terraform plan -lock-timeout.

D:

Changing the root backend and running init -migrate-state can transfer the existing snapshot to the newly configured destination; it addresses move an established project to remote state without abandoning resource identity, but this delivery instead requires serialize operations that write the same Terraform state and protect a workstation's local state file even when output values are hidden. The required combination involves State file confidentiality and A backend state lock, not the behavior of State migration from local storage.

F:

The force-unlock command removes a lock by its identifier; using it during an active operation can cause state corruption; it addresses release a stale lock when the original process is definitively gone, but this delivery instead requires serialize operations that write the same Terraform state and protect a workstation's local state file even when output values are hidden. The required combination involves State file confidentiality and A backend state lock, not the behavior of terraform force-unlock.

Question 575

An engineer intends to declare where a provider plugin comes from and which versions are acceptable and is reviewing “The required_providers block”. What consequence follows from using it as intended?

  1. The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections.
  2. The .terraform.lock.hcl file records selected provider versions and checksums to constrain subsequent installations.
  3. A required_providers entry maps a local provider name to its source address and version constraint; it does not configure API credentials.
  4. A version requirement such as >= 5.0.0 allows matching later versions but does not cap major-version upgrades.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to declare where a provider plugin comes from and which versions are acceptable, so it produces the behavior described. In contrast, the dependency lock file serves a different goal: reproduce previously selected provider package versions on other machines, not declare where a provider plugin comes from and which versions are acceptable.

Incorrect Answers

A:

The description applies to terraform init -upgrade when an engineer needs to intentionally reconsider previously locked provider and module selections; the named the required_providers block instead handles the requirement to declare where a provider plugin comes from and which versions are acceptable, so this behavior does not describe The required_providers block in the situation named.

B:

The description applies to the dependency lock file when an engineer needs to reproduce previously selected provider package versions on other machines; the named the required_providers block instead handles the requirement to declare where a provider plugin comes from and which versions are acceptable, so this behavior does not describe The required_providers block in the situation named.

D:

The description applies to a lower-bound provider constraint when an engineer needs to allow provider releases no older than a tested minimum; the named the required_providers block instead handles the requirement to declare where a provider plugin comes from and which versions are acceptable, so this behavior does not describe The required_providers block in the situation named.

Question 576

During one infrastructure delivery, the team must satisfy all of the following: (1) show which HCL formatting edits Terraform would make; (2) identify where a working directory keeps installed modules and initialization metadata. Select TWO appropriate Terraform approaches. Choose TWO.

  1. terraform fmt -diff
  2. Formatting versus validation
  3. Canonical HCL alignment
  4. Format before source review
  5. terraform init -migrate-state
  6. The .terraform directory

Explanation

Correct Answers

A:

The diff switch displays textual differences between current file formatting and the canonical formatting result; this meets the requirement to show which HCL formatting edits Terraform would make, while the other selected techniques address identify where a working directory keeps installed modules and initialization metadata, which require their own distinct Terraform mechanisms.

F:

Terraform creates .terraform for module caches, provider installations and backend/workspace metadata; it is not a substitute for committed configuration; this meets the requirement to identify where a working directory keeps installed modules and initialization metadata, while the other selected techniques address show which HCL formatting edits Terraform would make, which require their own distinct Terraform mechanisms.

Incorrect Answers

B:

terraform fmt addresses canonical HCL layout while terraform validate checks whether the configuration is structurally acceptable; it addresses distinguish style-only issues from Terraform type and schema errors, but this delivery instead requires show which HCL formatting edits Terraform would make and identify where a working directory keeps installed modules and initialization metadata. The required combination involves The .terraform directory and terraform fmt -diff, not the behavior of Formatting versus validation.

C:

The fmt operation normalizes the presentation of configuration source, not the meaning of provider API calls; it addresses keep spacing and indentation consistent between developers, but this delivery instead requires show which HCL formatting edits Terraform would make and identify where a working directory keeps installed modules and initialization metadata. The required combination involves The .terraform directory and terraform fmt -diff, not the behavior of Canonical HCL alignment.

D:

Applying formatter conventions consistently makes code review focus on meaningful resource and expression edits; it addresses reduce whitespace-only churn in infrastructure pull requests, but this delivery instead requires show which HCL formatting edits Terraform would make and identify where a working directory keeps installed modules and initialization metadata. The required combination involves The .terraform directory and terraform fmt -diff, not the behavior of Format before source review.

E:

The migrate-state flag attempts to copy prior state into the new backend and can prompt for migration confirmation; it addresses move existing state to a newly configured backend, but this delivery instead requires show which HCL formatting edits Terraform would make and identify where a working directory keeps installed modules and initialization metadata. The required combination involves The .terraform directory and terraform fmt -diff, not the behavior of terraform init -migrate-state.

Question 577

A Terraform reviewer encounters “terraform test” while assessing how to run declarative module tests instead of only checking syntax. Which statement correctly describes its actual behavior?

  1. Validation compares configuration with provider schemas and reports missing required fields.
  2. Provider schemas and Terraform's type checking can make validate fail before an apply is attempted.
  3. The Terraform test command executes defined test runs and assertions, which can exercise behavior beyond basic configuration validation.
  4. The fmt -check option exits with a failure status when source files would need formatting changes rather than altering them.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to run declarative module tests instead of only checking syntax, so it produces the behavior described. In contrast, missing required argument detection serves a different goal: catch a resource block lacking a mandatory argument, not run declarative module tests instead of only checking syntax.

Incorrect Answers

A:

The description applies to missing required argument detection when an engineer needs to catch a resource block lacking a mandatory argument; the named terraform test instead handles the requirement to run declarative module tests instead of only checking syntax, so this behavior does not describe terraform test in the situation named.

B:

The description applies to a type mismatch diagnosis when an engineer needs to catch an argument whose expression does not match the provider schema; the named terraform test instead handles the requirement to run declarative module tests instead of only checking syntax, so this behavior does not describe terraform test in the situation named.

D:

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 test instead handles the requirement to run declarative module tests instead of only checking syntax, so this behavior does not describe terraform test in the situation named.

Question 578

A release pipeline preparing provider access needs to avoid using provider versions from a newer unsupported major release. Which feature or operation is the most direct match?

  1. The required_version setting
  2. An upper-bound provider constraint
  3. Provider registry installation
  4. Lockfile source control

Explanation

Correct Answer

B:

A constraint such as < 6.0.0 prevents selection of versions that reach the excluded release boundary; this directly meets the requirement to avoid using provider versions from a newer unsupported major release. By comparison, lockfile source control is intended to share repeatable plugin selections with a development team, which is a different task from avoid using provider versions from a newer unsupported major release.

Incorrect Answers

A:

The terraform block's required_version expression constrains which Terraform executable can operate on the configuration; this mechanism is useful when the job is to restrict the Terraform CLI version rather than a provider plugin, whereas the current scenario requires the engineer to avoid using provider versions from a newer unsupported major release. These operations have different effects in the stated Terraform workflow.

C:

Terraform uses provider source metadata and its configured installation methods to find and install the appropriate plugin binary; this mechanism is useful when the job is to retrieve a published plugin from its declared registry source, whereas the current scenario requires the engineer to avoid using provider versions from a newer unsupported major release. These operations have different effects in the stated Terraform workflow.

D:

Checking .terraform.lock.hcl into version control preserves provider version selections and integrity hashes across workstations; this mechanism is useful when the job is to share repeatable plugin selections with a development team, whereas the current scenario requires the engineer to avoid using provider versions from a newer unsupported major release. These operations have different effects in the stated Terraform workflow.

Question 579

A Terraform reviewer encounters “Resource targeting as an exception” while assessing how to repair an isolated broken dependency while acknowledging incomplete plan coverage. Which statement correctly describes its actual behavior?

  1. With all attributes ignored during updates, Terraform can still create and destroy the resource but does not reconcile field-level changes.
  2. The depends_on edge can relate the whole counted resource block to an upstream resource, rather than computing one edge by list position.
  3. The lifecycle ignore_changes list excludes chosen attributes from later update comparisons while creation still considers configured values.
  4. The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to repair an isolated broken dependency while acknowledging incomplete plan coverage, so it produces the behavior described. In contrast, ignore_changes = all serves a different goal: disable updates to all managed resource attributes after creation, not repair an isolated broken dependency while acknowledging incomplete plan coverage.

Incorrect Answers

A:

The description applies to ignore_changes = all when an engineer needs to disable updates to all managed resource attributes after creation; the named resource targeting as an exception instead handles the requirement to repair an isolated broken dependency while acknowledging incomplete plan coverage, so this behavior does not describe Resource targeting as an exception in the situation named.

B:

The description applies to count and depends_on together when an engineer needs to make multiple resource instances wait for a shared prerequisite; the named resource targeting as an exception instead handles the requirement to repair an isolated broken dependency while acknowledging incomplete plan coverage, so this behavior does not describe Resource targeting as an exception in the situation named.

C:

The description applies to ignore_changes on a tag when an engineer needs to allow another system to update selected attributes without Terraform reverting them; the named resource targeting as an exception instead handles the requirement to repair an isolated broken dependency while acknowledging incomplete plan coverage, so this behavior does not describe Resource targeting as an exception in the situation named.

Question 580

An engineer intends to connect reviewed repository commits to automated infrastructure plans and is reviewing “HCP Terraform VCS integration”. What consequence follows from using it as intended?

  1. A module source can reference a private registry hostname and namespace after the client has appropriate authentication.
  2. A VCS-connected workspace coordinates code changes, speculative plans and controlled applies through supported repository integration.
  3. The HCP service token controls platform API authentication and is distinct from provider credentials used to modify cloud infrastructure.
  4. The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to connect reviewed repository commits to automated infrastructure plans, so it produces the behavior described. In contrast, an API token for CLI connectivity serves a different goal: authorize a Terraform CLI workflow to access an HCP Terraform organization, not connect reviewed repository commits to automated infrastructure plans.

Incorrect Answers

A:

The description applies to an HCP private registry module source when an engineer needs to consume a module managed by the organization's HCP private registry; the named HCP Terraform VCS integration instead handles the requirement to connect reviewed repository commits to automated infrastructure plans, so this behavior does not describe HCP Terraform VCS integration in the situation named.

C:

The description applies to an API token for CLI connectivity when an engineer needs to authorize a Terraform CLI workflow to access an HCP Terraform organization; the named HCP Terraform VCS integration instead handles the requirement to connect reviewed repository commits to automated infrastructure plans, so this behavior does not describe HCP Terraform VCS integration in the situation named.

D:

The description applies to a cloud workspaces tags setting when an engineer needs to select an HCP Terraform workspace collection by workspace tags; the named HCP Terraform VCS integration instead handles the requirement to connect reviewed repository commits to automated infrastructure plans, so this behavior does not describe HCP Terraform VCS integration in the situation named.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests