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

Question 1070

An engineer intends to publish selected values produced by an HCP Terraform run and is reviewing “Workspace outputs”. What consequence follows from using it as intended?

  1. Queued runs and workspace run management help serialize changes and avoid competing applies to one state.
  2. HCP Terraform maintains workspace state versions and supports collaboration without exposing a machine-local canonical state file.
  3. HCP Terraform can connect a workspace to a VCS repository and create runs when relevant commits are pushed.
  4. Workspace output values come from root module output blocks and can be consumed through supported interfaces.
  5. An HCP Terraform workspace organizes its own state and runs, providing a collaboration boundary for Terraform execution.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to publish selected values produced by an HCP Terraform run, so it produces the behavior described. In contrast, the HCP run queue serves a different goal: coordinate multiple requested changes against the same workspace state, not publish selected values produced by an HCP Terraform run.

Incorrect Answers

A:

The description applies to the HCP run queue when an engineer needs to coordinate multiple requested changes against the same workspace state; the named workspace outputs instead handles the requirement to publish selected values produced by an HCP Terraform run, so this behavior does not describe Workspace outputs in the situation named.

B:

The description applies to HCP Terraform remote state when an engineer needs to store Terraform state under managed service controls rather than a local file; the named workspace outputs instead handles the requirement to publish selected values produced by an HCP Terraform run, so this behavior does not describe Workspace outputs in the situation named.

C:

The description applies to a VCS-connected workspace when an engineer needs to trigger infrastructure runs from changes in a configured version-control repository; the named workspace outputs instead handles the requirement to publish selected values produced by an HCP Terraform run, so this behavior does not describe Workspace outputs in the situation named.

E:

The description applies to an HCP Terraform workspace when an engineer needs to associate configuration, variables, state and runs for one managed infrastructure scope; the named workspace outputs instead handles the requirement to publish selected values produced by an HCP Terraform run, so this behavior does not describe Workspace outputs in the situation named.

Question 1071

During one infrastructure delivery, the team must satisfy all of the following: (1) inspect the addresses of instances currently tracked in state; (2) configure API connection settings for an already required provider; (3) prevent a child module from silently using an unpassed alternate provider configuration. Select THREE appropriate Terraform approaches. Choose THREE.

  1. The provider block
  2. Explicit provider selection on data blocks
  3. The state serial number
  4. terraform state list
  5. Provider-defined data sources
  6. No implicit child-module alias inheritance

Explanation

Correct Answers

A:

A provider block can configure an endpoint, region or authentication parameters but should not carry the provider's version constraint; this meets the requirement to configure API connection settings for an already required provider, while the other selected techniques address inspect the addresses of instances currently tracked in state and prevent a child module from silently using an unpassed alternate provider configuration, which require their own distinct Terraform mechanisms.

D:

The state list command enumerates Terraform resource addresses without creating or deleting infrastructure; this meets the requirement to inspect the addresses of instances currently tracked in state, while the other selected techniques address configure API connection settings for an already required provider and prevent a child module from silently using an unpassed alternate provider configuration, which require their own distinct Terraform mechanisms.

F:

Non-default provider configurations must be passed explicitly to a child module instead of assuming aliases will propagate; this meets the requirement to prevent a child module from silently using an unpassed alternate provider configuration, while the other selected techniques address inspect the addresses of instances currently tracked in state and configure API connection settings for an already required provider, which require their own distinct Terraform mechanisms.

Incorrect Answers

B:

A data block can set provider = aws.secondary to query through an alternate provider configuration; it addresses read an object from a secondary account rather than the default account, but this delivery instead requires inspect the addresses of instances currently tracked in state and configure API connection settings for an already required provider and prevent a child module from silently using an unpassed alternate provider configuration. The required combination involves The provider block and No implicit child-module alias inheritance and terraform state list, not the behavior of Explicit provider selection on data blocks.

C:

State metadata includes lineage and serial information that helps Terraform identify state history and updates; it addresses understand how successive snapshots are ordered, but this delivery instead requires inspect the addresses of instances currently tracked in state and configure API connection settings for an already required provider and prevent a child module from silently using an unpassed alternate provider configuration. The required combination involves The provider block and No implicit child-module alias inheritance and terraform state list, not the behavior of The state serial number.

E:

A provider's data source reads existing data and exposes attributes without creating or destroying the queried object; it addresses read information from an external service without owning its lifecycle, but this delivery instead requires inspect the addresses of instances currently tracked in state and configure API connection settings for an already required provider and prevent a child module from silently using an unpassed alternate provider configuration. The required combination involves The provider block and No implicit child-module alias inheritance and terraform state list, not the behavior of Provider-defined data sources.

Question 1072

An engineering checklist calls for separate outcomes: (1) recreate the same logical infrastructure design across test and production; (2) run unchanged configuration repeatedly without inventing new infrastructure updates. Which TWO options implement the requested outcomes? Choose TWO.

  1. Drift detection during planning
  2. Repeatable environment definition
  3. State-backed object tracking
  4. Idempotent convergence
  5. Code review of infrastructure

Explanation

Correct Answers

B:

IaC configuration provides repeatable definitions; variables and isolated state allow environments to differ without independently hand-building each object; this meets the requirement to recreate the same logical infrastructure design across test and production, while the other selected techniques address run unchanged configuration repeatedly without inventing new infrastructure updates, which require their own distinct Terraform mechanisms.

D:

With no configuration or remote drift requiring action, a new plan normally proposes no infrastructure changes; this meets the requirement to run unchanged configuration repeatedly without inventing new infrastructure updates, while the other selected techniques address recreate the same logical infrastructure design across test and production, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

Terraform can refresh managed objects during planning and flag differences between the observed infrastructure and configuration; it addresses notice remote infrastructure changes made outside Terraform, but this delivery instead requires recreate the same logical infrastructure design across test and production and run unchanged configuration repeatedly without inventing new infrastructure updates. The required combination involves Repeatable environment definition and Idempotent convergence, not the behavior of Drift detection during planning.

C:

Terraform state records mappings and attributes needed to compare future plans without rediscovering every object's identity from scratch; it addresses retain the association between a configuration address and its actual managed object, but this delivery instead requires recreate the same logical infrastructure design across test and production and run unchanged configuration repeatedly without inventing new infrastructure updates. The required combination involves Repeatable environment definition and Idempotent convergence, not the behavior of State-backed object tracking.

E:

A version-control pull request can expose infrastructure edits to peer review, policy checks and automated validation; it addresses catch undesirable configuration changes before deployment, but this delivery instead requires recreate the same logical infrastructure design across test and production and run unchanged configuration repeatedly without inventing new infrastructure updates. The required combination involves Repeatable environment definition and Idempotent convergence, not the behavior of Code review of infrastructure.

Question 1073

During one infrastructure delivery, the team must satisfy all of the following: (1) read current attributes of managed remote objects during planning; (2) detect actual resource attributes rather than relying only on historical saved values. Select TWO appropriate Terraform approaches. Choose TWO.

  1. Provider integrity hashes
  2. terraform state list
  3. State access protection
  4. Provider data refresh
  5. Terraform refresh during planning

Explanation

Correct Answers

D:

Providers retrieve object details so Terraform can compare observed infrastructure against desired configuration and prior state; this meets the requirement to read current attributes of managed remote objects during planning, while the other selected techniques address detect actual resource attributes rather than relying only on historical saved values, which require their own distinct Terraform mechanisms.

E:

A normal plan attempts to refresh state from providers before comparing objects to the current configuration; this meets the requirement to detect actual resource attributes rather than relying only on historical saved values, while the other selected techniques address read current attributes of managed remote objects during planning, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

Terraform checks downloaded provider package checksums against lock information where hashes are available; it addresses detect a mismatched plugin distribution package, but this delivery instead requires read current attributes of managed remote objects during planning and detect actual resource attributes rather than relying only on historical saved values. The required combination involves Provider data refresh and Terraform refresh during planning, not the behavior of Provider integrity hashes.

B:

The state list command enumerates Terraform resource addresses without creating or deleting infrastructure; it addresses inspect the addresses of instances currently tracked in state, but this delivery instead requires read current attributes of managed remote objects during planning and detect actual resource attributes rather than relying only on historical saved values. The required combination involves Provider data refresh and Terraform refresh during planning, not the behavior of terraform state list.

C:

State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter; it addresses treat a Terraform state file as potentially sensitive data, but this delivery instead requires read current attributes of managed remote objects during planning and detect actual resource attributes rather than relying only on historical saved values. The required combination involves Provider data refresh and Terraform refresh during planning, not the behavior of State access protection.

Question 1074

An engineering checklist calls for separate outcomes: (1) retain a remote object but stop Terraform from managing it; (2) turn a compatible collection into a uniform-keyed map. Which TWO options implement the requested outcomes? Choose TWO.

  1. A resource attribute reference
  2. Resource removal without deletion
  3. tomap conversion
  4. for_each with a map
  5. Provider resource type prefixes

Explanation

Correct Answers

B:

A removed block with destroy = false can express a configuration-driven removal from state while leaving the infrastructure object intact; this meets the requirement to retain a remote object but stop Terraform from managing it, while the other selected techniques address turn a compatible collection into a uniform-keyed map, which require their own distinct Terraform mechanisms.

C:

tomap attempts to convert an input value into a map whose values share a compatible element type; this meets the requirement to turn a compatible collection into a uniform-keyed map, while the other selected techniques address retain a remote object but stop Terraform from managing it, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

References like aws_vpc.main.id use a managed resource's attributes and create an implicit dependency; it addresses pass a newly managed object's computed identifier to a dependent resource, but this delivery instead requires retain a remote object but stop Terraform from managing it and turn a compatible collection into a uniform-keyed map. The required combination involves Resource removal without deletion and tomap conversion, not the behavior of A resource attribute reference.

D:

A resource's for_each meta-argument accepts maps or sets of strings; map keys appear in resource addresses; it addresses create instances using stable logical keys rather than shifting numeric indexes, but this delivery instead requires retain a remote object but stop Terraform from managing it and turn a compatible collection into a uniform-keyed map. The required combination involves Resource removal without deletion and tomap conversion, not the behavior of for_each with a map.

E:

A resource type name usually starts with its provider local name, such as aws_instance for the AWS provider; it addresses identify which provider implements a resource's API operations, but this delivery instead requires retain a remote object but stop Terraform from managing it and turn a compatible collection into a uniform-keyed map. The required combination involves Resource removal without deletion and tomap conversion, not the behavior of Provider resource type prefixes.

Question 1075

An operations handover for an existing Terraform deployment has a concrete implementation goal: limit how many graph operations execute concurrently. What is the most appropriate Terraform mechanism?

  1. terraform apply -parallelism
  2. Apply using current credentials
  3. Refresh during apply planning
  4. Noninteractive apply settings

Explanation

Correct Answer

A:

The parallelism setting controls Terraform's concurrent resource operation count, which can mitigate API throttling; this directly meets the requirement to limit how many graph operations execute concurrently. By comparison, apply using current credentials is intended to determine which identity actually performs infrastructure changes, which is a different task from limit how many graph operations execute concurrently.

Incorrect Answers

B:

Provider API operations use the provider's configured credentials or supported ambient authentication, not the login name in a commit; this mechanism is useful when the job is to determine which identity actually performs infrastructure changes, whereas the current scenario requires the engineer to limit how many graph operations execute concurrently. These operations have different effects in the stated Terraform workflow.

C:

For a normal fresh apply, Terraform plans with current provider observations unless refresh is explicitly disabled; saved plan behavior differs; this mechanism is useful when the job is to avoid applying from stale remembered attributes after remote drift, whereas the current scenario requires the engineer to limit how many graph operations execute concurrently. These operations have different effects in the stated Terraform workflow.

D:

The -input=false option prevents prompts for missing input, requiring all necessary values and approvals to be handled by automation; this mechanism is useful when the job is to run Terraform in automation where prompting is not acceptable, whereas the current scenario requires the engineer to limit how many graph operations execute concurrently. These operations have different effects in the stated Terraform workflow.

Question 1076

A change request asks an engineer to use attributes read from an existing resource when configuring a new managed object. Which choice best implements the requested behavior?

  1. Removing a resource declaration
  2. Provider resource type prefixes
  3. A data-source reference
  4. Resource removal without deletion
  5. Resource local names

Explanation

Correct Answer

C:

References to data.TYPE.NAME.attribute retrieve values supplied by a read-only provider data source; this directly meets the requirement to use attributes read from an existing resource when configuring a new managed object. By comparison, resource removal without deletion is intended to retain a remote object but stop Terraform from managing it, which is a different task from use attributes read from an existing resource when configuring a new managed object.

Incorrect Answers

A:

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 attributes read from an existing resource when configuring a new managed object. These operations have different effects in the stated Terraform workflow.

B:

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 attributes read from an existing resource when configuring a new managed object. These operations have different effects in the stated Terraform workflow.

D:

A removed block with destroy = false can express a configuration-driven removal from state while leaving the infrastructure object intact; this mechanism is useful when the job is to retain a remote object but stop Terraform from managing it, whereas the current scenario requires the engineer to use attributes read from an existing resource when configuring a new managed object. These operations have different effects in the stated Terraform workflow.

E:

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 attributes read from an existing resource when configuring a new managed object. These operations have different effects in the stated Terraform workflow.

Question 1077

A Terraform runbook prescribes “A backend state lock” to avoid conflicting state updates during concurrent deployments, but it does not meet the requirement. What does that step actually accomplish?

  1. The lock-timeout option lets Terraform retry lock acquisition for a specified duration before returning an error.
  2. Backend state locking behavior depends on the backend implementation; remote storage alone does not guarantee safe locking.
  3. The -lock=false option bypasses locking safeguards and increases the risk of two runs writing inconsistent state.
  4. Supported backends acquire a state lock so simultaneous writers cannot corrupt or overwrite each other's state changes.

Explanation

Correct Answer

D:

A backend state lock is used when an operator needs to serialize operations that write the same Terraform state. Consequently, this choice cannot meet the separate requirement to avoid conflicting state updates during concurrent deployments. The intended action would instead require Not disabling locking for speed.

Incorrect Answers

A:

This behavior belongs to terraform plan -lock-timeout, which helps engineers wait for a temporary state lock instead of failing immediately rather than satisfying the separate requirement to avoid conflicting state updates during concurrent deployments. The attempted technique was A backend state lock; it would instead be used to serialize operations that write the same Terraform state, not to produce the effect associated with terraform plan -lock-timeout.

B:

This behavior belongs to Backend-specific lock support, which helps engineers check whether a chosen remote backend actually offers state locking rather than satisfying the separate requirement to avoid conflicting state updates during concurrent deployments. The attempted technique was A backend state lock; it would instead be used to serialize operations that write the same Terraform state, not to produce the effect associated with Backend-specific lock support.

C:

That outcome belongs to Not disabling locking for speed, the mechanism that can avoid conflicting state updates during concurrent deployments. The question concerns the engineer’s actual proposal, A backend state lock; it is directed at serialize operations that write the same Terraform state, not that result.

Question 1078

During one infrastructure delivery, the team must satisfy all of the following: (1) diagnose why destroy fails despite valid Terraform syntax; (2) catch an argument whose expression does not match the provider schema. Select TWO appropriate Terraform approaches. Choose TWO.

  1. terraform validate
  2. terraform apply -destroy
  3. A type mismatch diagnosis
  4. Validate without live deployment
  5. Resource-specific delete restrictions

Explanation

Correct Answers

C:

Provider schemas and Terraform's type checking can make validate fail before an apply is attempted; this meets the requirement to catch an argument whose expression does not match the provider schema, while the other selected techniques address diagnose why destroy fails despite valid Terraform syntax, which require their own distinct Terraform mechanisms.

E:

Providers and remote APIs can reject deletion when dependencies, protection flags or permissions prevent removing the object; this meets the requirement to diagnose why destroy fails despite valid Terraform syntax, while the other selected techniques address catch an argument whose expression does not match the provider schema, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

The validate command checks syntax and schema consistency in an initialized configuration without obtaining a full execution plan; it addresses check that Terraform configuration is structurally valid without planning resource changes, but this delivery instead requires diagnose why destroy fails despite valid Terraform syntax and catch an argument whose expression does not match the provider schema. The required combination involves A type mismatch diagnosis and Resource-specific delete restrictions, not the behavior of terraform validate.

B:

The destroy mode tells apply to plan removal of managed resources rather than ordinary convergence to resource declarations; it addresses execute a destroy-mode apply within a controlled workflow, but this delivery instead requires diagnose why destroy fails despite valid Terraform syntax and catch an argument whose expression does not match the provider schema. The required combination involves A type mismatch diagnosis and Resource-specific delete restrictions, not the behavior of terraform apply -destroy.

D:

terraform validate runs offline-oriented configuration checks and does not deploy managed resources; it addresses detect invalid configuration even when no cloud changes should occur, but this delivery instead requires diagnose why destroy fails despite valid Terraform syntax and catch an argument whose expression does not match the provider schema. The required combination involves A type mismatch diagnosis and Resource-specific delete restrictions, not the behavior of Validate without live deployment.

Question 1079

During an infrastructure design review about how to review past runs and changes in a shared HCP organization, a maintainer asks what “Workspace audit history” does. Which description is accurate?

  1. Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects.
  2. Run history records plan and apply activity to support team review and change tracking.
  3. Continuous validation can evaluate configuration check blocks to identify operational health issues in supported workspaces.
  4. Private registry modules can be published, versioned and discovered by authorized HCP Terraform users.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to review past runs and changes in a shared HCP organization, so it produces the behavior described. In contrast, organization variable sets serves a different goal: supply shared environment or Terraform input values across several workspaces, not review past runs and changes in a shared HCP organization.

Incorrect Answers

A:

The description applies to organization variable sets when an engineer needs to supply shared environment or Terraform input values across several workspaces; the named workspace audit history instead handles the requirement to review past runs and changes in a shared HCP organization, so this behavior does not describe Workspace audit history in the situation named.

C:

The description applies to HCP continuous validation when an engineer needs to monitor whether infrastructure-specific check assertions still pass after deployment; the named workspace audit history instead handles the requirement to review past runs and changes in a shared HCP organization, so this behavior does not describe Workspace audit history in the situation named.

D:

The description applies to the HCP private module registry when an engineer needs to share approved modules with organization members without relying on public registry visibility; the named workspace audit history instead handles the requirement to review past runs and changes in a shared HCP organization, so this behavior does not describe Workspace audit history in the situation named.

Question 1080

A diagnostic incident during Terraform execution has a concrete implementation goal: supply the remote identifier in the format accepted by the resource's provider. What is the most appropriate Terraform mechanism?

  1. terraform import ADDRESS ID
  2. terraform plan -generate-config-out
  3. Separate resources for separate imports
  4. An import block's id argument

Explanation

Correct Answer

D:

Provider documentation determines the required import identity; it may be an ID or compound identifier depending on resource type; this directly meets the requirement to supply the remote identifier in the format accepted by the resource's provider. 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 supply the remote identifier in the format accepted by the resource's provider.

Incorrect Answers

A:

The import CLI command records a provider-defined remote ID at a Terraform address but does not automatically write a complete resource block; this mechanism is useful when the job is to associate one existing remote object with a configured resource address, whereas the current scenario requires the engineer to supply the remote identifier in the format accepted by the resource's provider. These operations have different effects in the stated Terraform workflow.

B:

The experimental config-generation flag can write suggested resource declarations for review and correction before apply; this mechanism is useful when the job is to produce draft HCL for resources named in import blocks without matching configuration, whereas the current scenario requires the engineer to supply the remote identifier in the format accepted by the resource's provider. 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 supply the remote identifier in the format accepted by the resource's provider. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests