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

Question 850

A runbook lists “Environment parametrization” for the task to deploy similarly structured stacks with environment-specific settings. Which technical effect should its description include?

  1. With no configuration or remote drift requiring action, a new plan normally proposes no infrastructure changes.
  2. A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design.
  3. Terraform input variables permit different values for capacity, names and endpoints without copying the entire resource definition.
  4. Terraform can refresh managed objects during planning and flag differences between the observed infrastructure and configuration.
  5. A backend supporting remote storage and locking can centralize state and prevent conflicting concurrent changes.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to deploy similarly structured stacks with environment-specific settings, so it produces the behavior described. In contrast, collaboration through remote state serves a different goal: allow authorized operators to use one shared source of Terraform state, not deploy similarly structured stacks with environment-specific settings.

Incorrect Answers

A:

The description applies to idempotent convergence when an engineer needs to run unchanged configuration repeatedly without inventing new infrastructure updates; the named environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization in the situation named.

B:

The description applies to reusing modules when an engineer needs to standardize a reusable network pattern across multiple applications; the named environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization 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 environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization in the situation named.

E:

The description applies to collaboration through remote state when an engineer needs to allow authorized operators to use one shared source of Terraform state; the named environment parametrization instead handles the requirement to deploy similarly structured stacks with environment-specific settings, so this behavior does not describe Environment parametrization in the situation named.

Question 851

A release pipeline preparing provider access needs to read current attributes of managed remote objects during planning. Which feature or operation is the most direct match?

  1. Provider data refresh
  2. The provider block
  3. Provider aliases
  4. Implicit provider selection

Explanation

Correct Answer

A:

Providers retrieve object details so Terraform can compare observed infrastructure against desired configuration and prior state; this directly meets the requirement to read current attributes of managed remote objects during planning. By comparison, provider aliases is intended to configure two connections to the same service for different regions or accounts, which is a different task from read current attributes of managed remote objects during planning.

Incorrect Answers

B:

A provider block can configure an endpoint, region or authentication parameters but should not carry the provider's version constraint; this mechanism is useful when the job is to configure API connection settings for an already required provider, whereas the current scenario requires the engineer to read current attributes of managed remote objects during planning. These operations have different effects in the stated Terraform workflow.

C:

A provider configuration with alias defines a named alternate that resources or modules can explicitly select; this mechanism is useful when the job is to configure two connections to the same service for different regions or accounts, whereas the current scenario requires the engineer to read current attributes of managed remote objects during planning. These operations have different effects in the stated Terraform workflow.

D:

Terraform generally selects the default provider matching a resource's type prefix unless an alternate configuration is specified; this mechanism is useful when the job is to use the default provider configuration for a resource type, whereas the current scenario requires the engineer to read current attributes of managed remote objects during planning. These operations have different effects in the stated Terraform workflow.

Question 852

A state migration and recovery exercise has a concrete implementation goal: avoid expecting var.region or local.name to populate backend settings. What is the most appropriate Terraform mechanism?

  1. terraform init -migrate-state
  2. Remote backend access permissions
  3. No input variable interpolation in a backend block
  4. Backend state key separation

Explanation

Correct Answer

C:

Backend configuration is processed at initialization, before ordinary input expressions are evaluated, so it cannot use regular variables or locals; this directly meets the requirement to avoid expecting var.region or local.name to populate backend settings. By comparison, backend state key separation is intended to store different applications' state snapshots at distinct object paths, which is a different task from avoid expecting var.region or local.name to populate backend settings.

Incorrect Answers

A:

After changing backend configuration, migrate-state attempts to transfer existing state instead of starting with an empty one; this mechanism is useful when the job is to copy a known working state's snapshot into a new configured backend, whereas the current scenario requires the engineer to avoid expecting var.region or local.name to populate backend settings. These operations have different effects in the stated Terraform workflow.

B:

Cloud storage policy and backend authorization decide who can obtain or mutate stored Terraform state; provider credentials alone are not sufficient; this mechanism is useful when the job is to enforce read and write privileges on the state object, whereas the current scenario requires the engineer to avoid expecting var.region or local.name to populate backend settings. These operations have different effects in the stated Terraform workflow.

D:

Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot; this mechanism is useful when the job is to store different applications' state snapshots at distinct object paths, whereas the current scenario requires the engineer to avoid expecting var.region or local.name to populate backend settings. These operations have different effects in the stated Terraform workflow.

Question 853

A Terraform reviewer encounters “An explicit prevent_destroy rule” while assessing how to block a destructive plan for a protected configured resource. Which statement correctly describes its actual behavior?

  1. The destroy mode tells apply to plan removal of managed resources rather than ordinary convergence to resource declarations.
  2. Destroy planning shows the deletion proposal without carrying out the deletion until apply.
  3. The destroy command plans and applies removal of managed objects subject to lifecycle and provider constraints.
  4. The lifecycle prevent_destroy setting rejects a plan that destroys or replaces a configured resource while the rule remains present.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to block a destructive plan for a protected configured resource, so it produces the behavior described. In contrast, terraform plan -destroy serves a different goal: review an all-destroy plan before approving resource deletion, not block a destructive plan for a protected configured resource.

Incorrect Answers

A:

The description applies to terraform apply -destroy when an engineer needs to execute a destroy-mode apply within a controlled workflow; the named an explicit prevent_destroy rule instead handles the requirement to block a destructive plan for a protected configured resource, so this behavior does not describe An explicit prevent_destroy rule in the situation named.

B:

The description applies to terraform plan -destroy when an engineer needs to review an all-destroy plan before approving resource deletion; the named an explicit prevent_destroy rule instead handles the requirement to block a destructive plan for a protected configured resource, so this behavior does not describe An explicit prevent_destroy rule in the situation named.

C:

The description applies to terraform destroy when an engineer needs to remove the managed infrastructure described by the current Terraform configuration; the named an explicit prevent_destroy rule instead handles the requirement to block a destructive plan for a protected configured resource, so this behavior does not describe An explicit prevent_destroy rule in the situation named.

Question 854

During an infrastructure design review about how to avoid exposing full state when another stack only needs a published identifier, a maintainer asks what “Remote state sharing boundaries” does. Which description is accurate?

  1. State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter.
  2. A normal plan attempts to refresh state from providers before comparing objects to the current configuration.
  3. The state list command enumerates Terraform resource addresses without creating or deleting infrastructure.
  4. State can retain dependency information needed to correctly destroy objects no longer declared in configuration.
  5. Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure.

Explanation

Correct Answer

E:

The named mechanism is used when the objective is to avoid exposing full state when another stack only needs a published identifier, so it produces the behavior described. In contrast, state access protection serves a different goal: treat a Terraform state file as potentially sensitive data, not avoid exposing full state when another stack only needs a published identifier.

Incorrect Answers

A:

The description applies to state access protection when an engineer needs to treat a Terraform state file as potentially sensitive data; the named remote state sharing boundaries instead handles the requirement to avoid exposing full state when another stack only needs a published identifier, so this behavior does not describe Remote state sharing boundaries in the situation named.

B:

The description applies to Terraform refresh during planning when an engineer needs to detect actual resource attributes rather than relying only on historical saved values; the named remote state sharing boundaries instead handles the requirement to avoid exposing full state when another stack only needs a published identifier, so this behavior does not describe Remote state sharing boundaries in the situation named.

C:

The description applies to terraform state list when an engineer needs to inspect the addresses of instances currently tracked in state; the named remote state sharing boundaries instead handles the requirement to avoid exposing full state when another stack only needs a published identifier, so this behavior does not describe Remote state sharing boundaries in the situation named.

D:

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 remote state sharing boundaries instead handles the requirement to avoid exposing full state when another stack only needs a published identifier, so this behavior does not describe Remote state sharing boundaries in the situation named.

Question 855

A Terraform module author requires a way to use an existing DNS zone from a provider without taking ownership of the zone. Which Terraform approach most directly fulfills that request?

  1. A data source that depends on a resource
  2. Removing a resource declaration
  3. Resource local names
  4. Provider resource type prefixes
  5. Data sources as external lookups

Explanation

Correct Answer

E:

A provider data source can resolve the zone ID for use in managed records while the zone itself remains outside that configuration's resource lifecycle; this directly meets the requirement to use an existing DNS zone from a provider without taking ownership of the zone. By comparison, resource local names is intended to distinguish two managed instances of the same provider-defined resource type, which is a different task from use an existing DNS zone from a provider without taking ownership of the zone.

Incorrect Answers

A:

Data source reads can be deferred during planning when their inputs depend on values not known until apply; this mechanism is useful when the job is to delay a lookup until a prerequisite object is available, whereas the current scenario requires the engineer to use an existing DNS zone from a provider without taking ownership of the zone. These operations have different effects in the stated Terraform workflow.

B:

When a managed resource is absent from configuration but still tracked in state, normal planning proposes its destruction; this mechanism is useful when the job is to plan to delete a previously managed object that remains in state, whereas the current scenario requires the engineer to use an existing DNS zone from a provider without taking ownership of the zone. These operations have different effects in the stated Terraform workflow.

C:

A resource block has a type and a local label; together they form its address within the module; this mechanism is useful when the job is to distinguish two managed instances of the same provider-defined resource type, whereas the current scenario requires the engineer to use an existing DNS zone from a provider without taking ownership of the zone. These operations have different effects in the stated Terraform workflow.

D:

A resource type name usually starts with its provider local name, such as aws_instance for the AWS provider; this mechanism is useful when the job is to identify which provider implements a resource's API operations, whereas the current scenario requires the engineer to use an existing DNS zone from a provider without taking ownership of the zone. These operations have different effects in the stated Terraform workflow.

Question 856

A Terraform reviewer encounters “Write configuration first” while assessing how to express the intended infrastructure before asking Terraform for a plan. Which statement correctly describes its actual behavior?

  1. The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage.
  2. Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift.
  3. A revised configuration must be planned again because a prior plan does not automatically incorporate later edits.
  4. Committing root module files allows the team to relate plans and runs to a specific version of intended infrastructure.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to express the intended infrastructure before asking Terraform for a plan, so it produces the behavior described. In contrast, keep configuration in version control serves a different goal: tie an approved infrastructure change to a reviewed commit, not express the intended infrastructure before asking Terraform for a plan.

Incorrect Answers

B:

The description applies to check infrastructure after apply when an engineer needs to confirm deployed outputs and state match the expected result; the named write configuration first instead handles the requirement to express the intended infrastructure before asking Terraform for a plan, so this behavior does not describe Write configuration first in the situation named.

C:

The description applies to iterate after feedback when an engineer needs to modify and re-plan after a change request is rejected; the named write configuration first instead handles the requirement to express the intended infrastructure before asking Terraform for a plan, so this behavior does not describe Write configuration first in the situation named.

D:

The description applies to keep configuration in version control when an engineer needs to tie an approved infrastructure change to a reviewed commit; the named write configuration first instead handles the requirement to express the intended infrastructure before asking Terraform for a plan, so this behavior does not describe Write configuration first in the situation named.

Question 857

A Terraform change proposal names “Avoiding dependency cycles” to resolve a graph where two resources each depend on the other. Which outcome can reviewers attribute to that particular mechanism?

  1. var.NAME reads a declared input variable in the module where the variable block is defined.
  2. A resource address inside a module ordinarily uses TYPE.NAME, with optional instance indexing when count or for_each is used.
  3. Terraform cannot order a cycle of dependencies; restructure references or resource design to remove the circular edge.
  4. Instances made from a map or string set have addresses such as aws_instance.web["blue"], rather than an integer count index.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to resolve a graph where two resources each depend on the other, so it produces the behavior described. In contrast, a variable reference serves a different goal: inject a caller-supplied input into a resource argument, not resolve a graph where two resources each depend on the other.

Incorrect Answers

A:

The description applies to a variable reference when an engineer needs to inject a caller-supplied input into a resource argument; the named avoiding dependency cycles instead handles the requirement to resolve a graph where two resources each depend on the other, so this behavior does not describe Avoiding dependency cycles in the situation named.

B:

The description applies to the resource address format when an engineer needs to identify a resource instance by its type and local name; the named avoiding dependency cycles instead handles the requirement to resolve a graph where two resources each depend on the other, so this behavior does not describe Avoiding dependency cycles in the situation named.

D:

The description applies to a for_each instance address when an engineer needs to identify a single managed object selected by a string key; the named avoiding dependency cycles instead handles the requirement to resolve a graph where two resources each depend on the other, so this behavior does not describe Avoiding dependency cycles in the situation named.

Question 858

A change request asks an engineer to obtain the current state snapshot for inspection or controlled backup. Which choice best implements the requested behavior?

  1. A data source instead of import
  2. A moved block
  3. ignore_changes for shared ownership
  4. terraform state pull

Explanation

Correct Answer

D:

The state pull command retrieves state from the configured backend and prints a snapshot that may contain secrets; this directly meets the requirement to obtain the current state snapshot for inspection or controlled backup. By comparison, a moved block is intended to rename or relocate a managed resource address without recreating the remote object, which is a different task from obtain the current state snapshot for inspection or controlled backup.

Incorrect Answers

A:

A data block can read an external object's attributes while avoiding taking over its create-update-delete lifecycle; this mechanism is useful when the job is to refer to shared infrastructure that another stack owns without changing its lifecycle, whereas the current scenario requires the engineer to obtain the current state snapshot for inspection or controlled backup. These operations have different effects in the stated Terraform workflow.

B:

A moved block maps an old Terraform address to a new one so state follows the refactor rather than planning destruction and creation; this mechanism is useful when the job is to rename or relocate a managed resource address without recreating the remote object, whereas the current scenario requires the engineer to obtain the current state snapshot for inspection or controlled backup. These operations have different effects in the stated Terraform workflow.

C:

The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed; this mechanism is useful when the job is to stop Terraform from overwriting a field delegated to an external controller, whereas the current scenario requires the engineer to obtain the current state snapshot for inspection or controlled backup. These operations have different effects in the stated Terraform workflow.

Question 859

A collaboration and governance review needs to preview an estimated cost impact of planned infrastructure changes when available. Which feature or operation is the most direct match?

  1. HCP team permissions
  2. HCP provider dynamic credentials
  3. Project-based permission boundaries
  4. Cost estimation

Explanation

Correct Answer

D:

HCP Terraform can estimate resource costs for supported providers and resources before apply; estimates are not invoices; this directly meets the requirement to preview an estimated cost impact of planned infrastructure changes when available. By comparison, HCP provider dynamic credentials is intended to replace standing cloud keys with short-lived run identities, which is a different task from preview an estimated cost impact of planned infrastructure changes when available.

Incorrect Answers

A:

Team access controls define which users may perform supported workspace operations rather than relying only on provider credentials; this mechanism is useful when the job is to grant operators different abilities to view, plan or apply workspace changes, whereas the current scenario requires the engineer to preview an estimated cost impact of planned infrastructure changes when available. These operations have different effects in the stated Terraform workflow.

B:

HCP Terraform can use supported dynamic provider credentials that are generated for runs rather than stored as permanent workspace secrets; this mechanism is useful when the job is to replace standing cloud keys with short-lived run identities, whereas the current scenario requires the engineer to preview an estimated cost impact of planned infrastructure changes when available. 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 preview an estimated cost impact of planned infrastructure changes when available. These operations have different effects in the stated Terraform workflow.

Question 860

A change request asks an engineer to prevent incompatible provider upgrades from affecting resource handling. Which choice best implements the requested behavior?

  1. Provider authentication environment variables
  2. Provider version compatibility
  3. The provider registry namespace
  4. Provider-defined data sources

Explanation

Correct Answer

B:

Version constraints and a shared lock file reduce unintended schema and behavior changes between deployments; this directly meets the requirement to prevent incompatible provider upgrades from affecting resource handling. By comparison, the provider registry namespace is intended to identify the publisher when providers share a type name, which is a different task from prevent incompatible provider upgrades from affecting resource handling.

Incorrect Answers

A:

Many provider plugins can read credentials from provider-specific environment variables or identity mechanisms, reducing secret exposure in configuration; this mechanism is useful when the job is to avoid hard-coding a provider's API credential into .tf files, whereas the current scenario requires the engineer to prevent incompatible provider upgrades from affecting resource handling. These operations have different effects in the stated Terraform workflow.

C:

The namespace portion of a source address separates provider publishers in the registry; this mechanism is useful when the job is to identify the publisher when providers share a type name, whereas the current scenario requires the engineer to prevent incompatible provider upgrades from affecting resource handling. These operations have different effects in the stated Terraform workflow.

D:

A provider's data source reads existing data and exposes attributes without creating or destroying the queried object; this mechanism is useful when the job is to read information from an external service without owning its lifecycle, whereas the current scenario requires the engineer to prevent incompatible provider upgrades from affecting resource handling. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests