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

Question 730

During a design review, the requirement is to prevent a developer with read access from automatically applying production changes. Which option should the engineer select?

  1. Drift detection in HCP Terraform
  2. Organization variable sets
  3. Workspace access separation
  4. HCP continuous validation

Explanation

Correct Answer

C:

HCP Terraform permissions differentiate viewing configuration and runs from authorized apply or administration operations; this directly meets the requirement to prevent a developer with read access from automatically applying production changes. By comparison, HCP continuous validation is intended to monitor whether infrastructure-specific check assertions still pass after deployment, which is a different task from prevent a developer with read access from automatically applying production changes.

Incorrect Answers

A:

HCP Terraform health features can detect changes made outside the workspace's managed Terraform workflow; this mechanism is useful when the job is to identify remote infrastructure deviations through scheduled or managed health assessments, whereas the current scenario requires the engineer to prevent a developer with read access from automatically applying production changes. These operations have different effects in the stated Terraform workflow.

B:

Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects; this mechanism is useful when the job is to supply shared environment or Terraform input values across several workspaces, whereas the current scenario requires the engineer to prevent a developer with read access from automatically applying production changes. These operations have different effects in the stated Terraform workflow.

D:

Continuous validation can evaluate configuration check blocks to identify operational health issues in supported workspaces; this mechanism is useful when the job is to monitor whether infrastructure-specific check assertions still pass after deployment, whereas the current scenario requires the engineer to prevent a developer with read access from automatically applying production changes. These operations have different effects in the stated Terraform workflow.

Question 731

A runbook lists “The dependency graph during planning” for the task to explain why two unrelated resources can be planned and applied in parallel. Which technical effect should its description include?

  1. Planning calculates an execution proposal after reading configuration and usually refreshing managed resource data.
  2. In conventional human-readable plans, + signifies that a managed resource is proposed for creation.
  3. Terraform graph nodes can run concurrently when no dependency edge requires a particular order.
  4. Targeting narrows planning scope and can miss other required changes, so it is not the normal long-term workflow.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to explain why two unrelated resources can be planned and applied in parallel, so it produces the behavior described. In contrast, terraform plan -target serves a different goal: limit a recovery-oriented plan to a resource and its dependencies, not explain why two unrelated resources can be planned and applied in parallel.

Incorrect Answers

A:

The description applies to terraform plan when an engineer needs to preview resource actions implied by the current configuration and state; the named the dependency graph during planning instead handles the requirement to explain why two unrelated resources can be planned and applied in parallel, so this behavior does not describe The dependency graph during planning in the situation named.

B:

The description applies to a resource action marked plus when an engineer needs to interpret the leading + symbol in Terraform's plan; the named the dependency graph during planning instead handles the requirement to explain why two unrelated resources can be planned and applied in parallel, so this behavior does not describe The dependency graph during planning in the situation named.

D:

The description applies to terraform plan -target when an engineer needs to limit a recovery-oriented plan to a resource and its dependencies; the named the dependency graph during planning instead handles the requirement to explain why two unrelated resources can be planned and applied in parallel, so this behavior does not describe The dependency graph during planning in the situation named.

Question 732

A change request asks an engineer to display the current state or a saved plan in a human-readable way. Which choice best implements the requested behavior?

  1. terraform output
  2. terraform workspace list
  3. terraform state mv
  4. terraform state list
  5. terraform show

Explanation

Correct Answer

E:

The show command renders state or plan content without being an apply operation; this directly meets the requirement to display the current state or a saved plan in a human-readable way. By comparison, terraform output is intended to read values explicitly declared as root outputs of the configuration, which is a different task from display the current state or a saved plan in a human-readable way.

Incorrect Answers

A:

The output command reports root output values rather than listing every raw attribute from state; this mechanism is useful when the job is to read values explicitly declared as root outputs of the configuration, whereas the current scenario requires the engineer to display the current state or a saved plan in a human-readable way. These operations have different effects in the stated Terraform workflow.

B:

Workspace list shows logical Terraform workspaces, which may correspond to separate state instances depending on backend support; this mechanism is useful when the job is to list the workspaces available through the initialized backend, whereas the current scenario requires the engineer to display the current state or a saved plan in a human-readable way. These operations have different effects in the stated Terraform workflow.

C:

State mv updates address mapping within state and does not move the real infrastructure object between regions or accounts; this mechanism is useful when the job is to change a tracked object's resource address after an intentional refactor, whereas the current scenario requires the engineer to display the current state or a saved plan in a human-readable way. These operations have different effects in the stated Terraform workflow.

D:

The state list subcommand prints stored addresses without changing infrastructure or state content; this mechanism is useful when the job is to enumerate managed resource instance addresses in the current state, whereas the current scenario requires the engineer to display the current state or a saved plan in a human-readable way. These operations have different effects in the stated Terraform workflow.

Question 733

The team evaluates “terraform state rm” for a requirement to forget a managed object without destroying the corresponding real infrastructure. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. State metadata such as lineage and serial helps protect against incompatible or stale state updates.
  2. The state rm command removes the association so the remote object remains but is no longer tracked by that state.
  3. Configuration still describes the preferred value, so normal planning can propose undoing an out-of-band modification unless ignored.
  4. Manual state-file changes can break address mappings or serial consistency; commands such as state mv and moved blocks are safer.
  5. Providers refresh remote resource attributes, and planning can propose updates to bring changed objects back to declared configuration.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to forget a managed object without destroying the corresponding real infrastructure, so it produces the behavior described. In contrast, a refreshed changed resource serves a different goal: understand why Terraform tries to reset a manually edited resource attribute, not forget a managed object without destroying the corresponding real infrastructure.

Incorrect Answers

A:

The description applies to serial and lineage checks when an engineer needs to detect that a state snapshot belongs to a different history or older generation; the named terraform state rm instead handles the requirement to forget a managed object without destroying the corresponding real infrastructure, so this behavior does not describe terraform state rm in the situation named.

C:

The description applies to a refreshed changed resource when an engineer needs to understand why Terraform tries to reset a manually edited resource attribute; the named terraform state rm instead handles the requirement to forget a managed object without destroying the corresponding real infrastructure, so this behavior does not describe terraform state rm in the situation named.

D:

The description applies to avoid direct state JSON editing when an engineer needs to make state changes through supported Terraform commands and declarative refactors; the named terraform state rm instead handles the requirement to forget a managed object without destroying the corresponding real infrastructure, so this behavior does not describe terraform state rm in the situation named.

E:

The description applies to a normal plan with drift when an engineer needs to detect and propose correction for changes made outside Terraform; the named terraform state rm instead handles the requirement to forget a managed object without destroying the corresponding real infrastructure, so this behavior does not describe terraform state rm in the situation named.

Question 734

An engineer intends to extract a specific range of characters from a string and is reviewing “The substr function”. What consequence follows from using it as intended?

  1. substr returns characters starting at an offset with the specified length rather than splitting on a delimiter.
  2. concat joins lists end to end and preserves their element ordering, including duplicate values.
  3. templatefile reads a template and evaluates placeholders using the supplied variable map.
  4. replace searches a string for a matching substring or pattern and replaces matches with a new string.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to extract a specific range of characters from a string, so it produces the behavior described. In contrast, the replace function serves a different goal: substitute matching substrings within a value, not extract a specific range of characters from a string.

Incorrect Answers

B:

The description applies to the concat function when an engineer needs to append the elements of multiple lists into one sequence; the named the substr function instead handles the requirement to extract a specific range of characters from a string, so this behavior does not describe The substr function in the situation named.

C:

The description applies to the templatefile function when an engineer needs to render a file containing template expressions with an object of variables; the named the substr function instead handles the requirement to extract a specific range of characters from a string, so this behavior does not describe The substr function in the situation named.

D:

The description applies to the replace function when an engineer needs to substitute matching substrings within a value; the named the substr function instead handles the requirement to extract a specific range of characters from a string, so this behavior does not describe The substr function in the situation named.

Question 735

An operations runbook for tracked objects has a concrete implementation goal: avoid permanent trace logs in normal automated runs. What is the most appropriate Terraform mechanism?

  1. TF_LOG=INFO
  2. Verbose logging only during diagnosis
  3. TF_LOG_CORE
  4. TF_LOG=ERROR
  5. TF_LOG=TRACE
  6. Disabling TF_LOG

Explanation

Correct Answer

B:

High verbosity creates large logs and greater secret-exposure risk; enable it for a specific incident and disable it afterward; this directly meets the requirement to avoid permanent trace logs in normal automated runs. By comparison, TF_LOG=TRACE is intended to obtain detailed Terraform core and provider diagnostic output while troubleshooting, which is a different task from avoid permanent trace logs in normal automated runs.

Incorrect Answers

A:

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 avoid permanent trace logs in normal automated runs. These operations have different effects in the stated Terraform workflow.

C:

The TF_LOG_CORE variable can control log verbosity for Core messages independently of general logging; this mechanism is useful when the job is to focus verbose diagnostics on Terraform Core rather than all plugin activity, whereas the current scenario requires the engineer to avoid permanent trace logs in normal automated runs. These operations have different effects in the stated Terraform workflow.

D:

ERROR restricts diagnostic output to serious problems rather than normal trace-level activity; this mechanism is useful when the job is to focus logging on error-level diagnostics, whereas the current scenario requires the engineer to avoid permanent trace logs in normal automated runs. These operations have different effects in the stated Terraform workflow.

E:

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 avoid permanent trace logs in normal automated runs. These operations have different effects in the stated Terraform workflow.

F:

Unsetting or disabling Terraform's TF_LOG environment setting removes extra diagnostic verbosity from later commands; this mechanism is useful when the job is to return a shell session to ordinary Terraform logging after investigation, whereas the current scenario requires the engineer to avoid permanent trace logs in normal automated runs. These operations have different effects in the stated Terraform workflow.

Question 736

The team evaluates “terraform workspace select” for a requirement to switch the currently selected Terraform CLI workspace. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. The providers command displays provider requirements and their module relationships for dependency troubleshooting.
  2. State show presents one resource's stored attributes in human-readable form and may reveal secret values.
  3. Workspace selection changes which workspace state namespace the root configuration uses; it does not select a cloud account automatically.
  4. State rm deletes the state association, not the object in the external system.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to switch the currently selected Terraform CLI workspace, so it produces the behavior described. In contrast, terraform state rm serves a different goal: stop tracking a resource without telling its provider to delete the remote object, not switch the currently selected Terraform CLI workspace.

Incorrect Answers

A:

The description applies to terraform providers when an engineer needs to inspect which providers the current configuration requires; the named terraform workspace select instead handles the requirement to switch the currently selected Terraform CLI workspace, so this behavior does not describe terraform workspace select in the situation named.

B:

The description applies to terraform state show ADDRESS when an engineer needs to view attributes for a specified state-tracked resource instance; the named terraform workspace select instead handles the requirement to switch the currently selected Terraform CLI workspace, so this behavior does not describe terraform workspace select in the situation named.

D:

The description applies to terraform state rm when an engineer needs to stop tracking a resource without telling its provider to delete the remote object; the named terraform workspace select instead handles the requirement to switch the currently selected Terraform CLI workspace, so this behavior does not describe terraform workspace select in the situation named.

Question 737

A change request asks an engineer to associate an HCP Terraform workspace with an intended project during configuration. Which choice best implements the requested behavior?

  1. Dynamic provider credential integration
  2. HCP Terraform run tasks integration
  3. terraform init after adding cloud integration
  4. Terraform Enterprise hostname selection
  5. A cloud block project selector

Explanation

Correct Answer

E:

The cloud workspaces block supports a project setting for organizing related workspace integration; this directly meets the requirement to associate an HCP Terraform workspace with an intended project during configuration. By comparison, HCP Terraform run tasks integration is intended to send proposed changes to a third-party quality or security check service, which is a different task from associate an HCP Terraform workspace with an intended project during configuration.

Incorrect Answers

A:

Dynamic credentials integrate HCP Terraform with supported identity federation to obtain scoped run credentials; this mechanism is useful when the job is to grant HCP runs temporary cloud authorization instead of long-lived static secrets, whereas the current scenario requires the engineer to associate an HCP Terraform workspace with an intended project during configuration. These operations have different effects in the stated Terraform workflow.

B:

Run tasks integrate external systems into workflow checkpoints without changing the Terraform resource graph directly; this mechanism is useful when the job is to send proposed changes to a third-party quality or security check service, whereas the current scenario requires the engineer to associate an HCP Terraform workspace with an intended project during configuration. These operations have different effects in the stated Terraform workflow.

C:

Running init processes the cloud block and configures workspace connectivity before plans or applies; this mechanism is useful when the job is to configure the local working directory to connect with the selected HCP workspace, whereas the current scenario requires the engineer to associate an HCP Terraform workspace with an intended project during configuration. These operations have different effects in the stated Terraform workflow.

D:

The cloud hostname setting and login host identify the relevant service installation for organization operations; this mechanism is useful when the job is to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, whereas the current scenario requires the engineer to associate an HCP Terraform workspace with an intended project during configuration. These operations have different effects in the stated Terraform workflow.

Question 738

A build job for a Terraform configuration has a concrete implementation goal: confirm deployed outputs and state match the expected result. What is the most appropriate Terraform mechanism?

  1. Check infrastructure after apply
  2. Write configuration first
  3. Review a plan before apply
  4. Apply reviewed configuration

Explanation

Correct Answer

A:

Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift; this directly meets the requirement to confirm deployed outputs and state match the expected result. By comparison, apply reviewed configuration is intended to execute the approved set of infrastructure changes, which is a different task from confirm deployed outputs and state match the expected result.

Incorrect Answers

B:

The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage; this mechanism is useful when the job is to express the intended infrastructure before asking Terraform for a plan, whereas the current scenario requires the engineer to confirm deployed outputs and state match the expected result. These operations have different effects in the stated Terraform workflow.

C:

The plan stage compares desired configuration with observed resource state and shows the proposed operations for review; this mechanism is useful when the job is to inspect predicted create, update and delete actions prior to making changes, whereas the current scenario requires the engineer to confirm deployed outputs and state match the expected result. These operations have different effects in the stated Terraform workflow.

D:

terraform apply invokes providers to carry out selected planned operations and updates state with their results; this mechanism is useful when the job is to execute the approved set of infrastructure changes, whereas the current scenario requires the engineer to confirm deployed outputs and state match the expected result. These operations have different effects in the stated Terraform workflow.

Question 739

A Terraform change proposal names “Provider resource type prefixes” to identify which provider implements a resource's API operations. Which outcome can reviewers attribute to that particular mechanism?

  1. The built-in terraform_data resource can represent input changes and trigger replacement behavior without managing a cloud API resource.
  2. Import associates a configured resource address with an existing remote object's provider identity in Terraform state.
  3. References like aws_vpc.main.id use a managed resource's attributes and create an implicit dependency.
  4. A resource type name usually starts with its provider local name, such as aws_instance for the AWS provider.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to identify which provider implements a resource's API operations, so it produces the behavior described. In contrast, a resource attribute reference serves a different goal: pass a newly managed object's computed identifier to a dependent resource, not identify which provider implements a resource's API operations.

Incorrect Answers

A:

The description applies to the terraform_data resource when an engineer needs to model a Terraform-managed lifecycle value without requiring an external service object; the named provider resource type prefixes instead handles the requirement to identify which provider implements a resource's API operations, so this behavior does not describe Provider resource type prefixes in the situation named.

B:

The description applies to importing an existing object when an engineer needs to bring a previously unmanaged remote object under a resource block's lifecycle; the named provider resource type prefixes instead handles the requirement to identify which provider implements a resource's API operations, so this behavior does not describe Provider resource type prefixes in the situation named.

C:

The description applies to a resource attribute reference when an engineer needs to pass a newly managed object's computed identifier to a dependent resource; the named provider resource type prefixes instead handles the requirement to identify which provider implements a resource's API operations, so this behavior does not describe Provider resource type prefixes in the situation named.

Question 740

A reusable module interface review needs to call a child module from an explicit filesystem path. Which feature or operation is the most direct match?

  1. An absolute local module source
  2. A Git ref query parameter
  3. Registry module documentation
  4. terraform init for modules

Explanation

Correct Answer

A:

Terraform can load a module from a local filesystem path, though absolute paths make configurations less portable; this directly meets the requirement to call a child module from an explicit filesystem path. By comparison, a Git ref query parameter is intended to pin a VCS module to a specific Git branch, tag or commit, which is a different task from call a child module from an explicit filesystem path.

Incorrect Answers

B:

A source address ending in ?ref=... selects a Git revision; it does not use the registry-specific module version argument; this mechanism is useful when the job is to pin a VCS module to a specific Git branch, tag or commit, whereas the current scenario requires the engineer to call a child module from an explicit filesystem path. 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 call a child module from an explicit filesystem path. These operations have different effects in the stated Terraform workflow.

D:

Initialization retrieves module sources and populates .terraform/modules while preparing other required dependencies; this mechanism is useful when the job is to install all referenced remote child modules before planning, whereas the current scenario requires the engineer to call a child module from an explicit filesystem path. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests