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

Question 550

A new Terraform working directory has a concrete implementation goal: install approved plugins from an internal distribution location. What is the most appropriate Terraform mechanism?

  1. A provider mirror
  2. Lockfile source control
  3. terraform init -upgrade
  4. Provider registry installation

Explanation

Correct Answer

A:

A CLI provider_installation configuration can direct provider package discovery to a network or filesystem mirror; this directly meets the requirement to install approved plugins from an internal distribution location. By comparison, provider registry installation is intended to retrieve a published plugin from its declared registry source, which is a different task from install approved plugins from an internal distribution location.

Incorrect Answers

B:

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 install approved plugins from an internal distribution location. These operations have different effects in the stated Terraform workflow.

C:

The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections; this mechanism is useful when the job is to intentionally reconsider previously locked provider and module selections, whereas the current scenario requires the engineer to install approved plugins from an internal distribution location. These operations have different effects in the stated Terraform workflow.

D:

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 install approved plugins from an internal distribution location. These operations have different effects in the stated Terraform workflow.

Question 551

During a design review, the requirement is to share one calculated expression among multiple resources in a module. Which option should the engineer select?

  1. count.index
  2. An instance address with count
  3. Avoiding dependency cycles
  4. A local value reference

Explanation

Correct Answer

D:

The syntax local.NAME accesses a locally defined expression evaluated in the current module; this directly meets the requirement to share one calculated expression among multiple resources in a module. By comparison, an instance address with count is intended to refer specifically to the second object of a count-created resource, which is a different task from share one calculated expression among multiple resources in a module.

Incorrect Answers

A:

Resources using count can refer to the current instance number through count.index, a zero-based integer; this mechanism is useful when the job is to build a numbered name for each instance created using count, whereas the current scenario requires the engineer to share one calculated expression among multiple resources in a module. These operations have different effects in the stated Terraform workflow.

B:

Count instances have numeric indexes such as aws_instance.web[1] for the second instance; this mechanism is useful when the job is to refer specifically to the second object of a count-created resource, whereas the current scenario requires the engineer to share one calculated expression among multiple resources in a module. These operations have different effects in the stated Terraform workflow.

C:

Terraform cannot order a cycle of dependencies; restructure references or resource design to remove the circular edge; this mechanism is useful when the job is to resolve a graph where two resources each depend on the other, whereas the current scenario requires the engineer to share one calculated expression among multiple resources in a module. These operations have different effects in the stated Terraform workflow.

Question 552

A change request asks an engineer to configure API connection settings for an already required provider. Which choice best implements the requested behavior?

  1. Terraform Core
  2. The provider block
  3. Provider data refresh
  4. Implicit provider selection
  5. Provider-defined resource schemas

Explanation

Correct Answer

B:

A provider block can configure an endpoint, region or authentication parameters but should not carry the provider's version constraint; this directly meets the requirement to configure API connection settings for an already required provider. By comparison, provider data refresh is intended to read current attributes of managed remote objects during planning, which is a different task from configure API connection settings for an already required provider.

Incorrect Answers

A:

Terraform Core handles language evaluation, planning and state orchestration while provider plugins execute service-specific operations; this mechanism is useful when the job is to evaluate HCL expressions and calculate a resource dependency graph, whereas the current scenario requires the engineer to configure API connection settings for an already required provider. These operations have different effects in the stated Terraform workflow.

C:

Providers retrieve object details so Terraform can compare observed infrastructure against desired configuration and prior state; this mechanism is useful when the job is to read current attributes of managed remote objects during planning, whereas the current scenario requires the engineer to configure API connection settings for an already required provider. 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 configure API connection settings for an already required provider. These operations have different effects in the stated Terraform workflow.

E:

The provider declares accepted resource arguments and computed attributes; Terraform validates configuration against that schema; this mechanism is useful when the job is to determine which arguments a resource type accepts, whereas the current scenario requires the engineer to configure API connection settings for an already required provider. These operations have different effects in the stated Terraform workflow.

Question 553

A Terraform change proposal names “The required_version setting” to restrict the Terraform CLI version rather than a provider plugin. Which outcome can reviewers attribute to that particular mechanism?

  1. The providers lock subcommand updates dependency lock information, including hashes for specified target operating-system platforms.
  2. The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections.
  3. Initialization resolves provider requirements, installs plugins, and prepares modules and backend settings in the working directory.
  4. The .terraform.lock.hcl file records selected provider versions and checksums to constrain subsequent installations.
  5. A CLI provider_installation configuration can direct provider package discovery to a network or filesystem mirror.
  6. The terraform block's required_version expression constrains which Terraform executable can operate on the configuration.

Explanation

Correct Answer

F:

The named mechanism is used when the objective is to restrict the Terraform CLI version rather than a provider plugin, so it produces the behavior described. In contrast, terraform init -upgrade serves a different goal: intentionally reconsider previously locked provider and module selections, not restrict the Terraform CLI version rather than a provider plugin.

Incorrect Answers

A:

The description applies to terraform providers lock when an engineer needs to populate provider package checksums for selected platforms; the named the required_version setting instead handles the requirement to restrict the Terraform CLI version rather than a provider plugin, so this behavior does not describe The required_version setting in the situation named.

B:

The description applies to terraform init -upgrade when an engineer needs to intentionally reconsider previously locked provider and module selections; the named the required_version setting instead handles the requirement to restrict the Terraform CLI version rather than a provider plugin, so this behavior does not describe The required_version setting in the situation named.

C:

The description applies to terraform init when an engineer needs to download missing required provider plugins before planning; the named the required_version setting instead handles the requirement to restrict the Terraform CLI version rather than a provider plugin, so this behavior does not describe The required_version setting in the situation named.

D:

The description applies to the dependency lock file when an engineer needs to reproduce previously selected provider package versions on other machines; the named the required_version setting instead handles the requirement to restrict the Terraform CLI version rather than a provider plugin, so this behavior does not describe The required_version setting in the situation named.

E:

The description applies to a provider mirror when an engineer needs to install approved plugins from an internal distribution location; the named the required_version setting instead handles the requirement to restrict the Terraform CLI version rather than a provider plugin, so this behavior does not describe The required_version setting in the situation named.

Question 554

A runbook lists “Provider configuration inheritance” for the task to understand which provider settings a child module can use from its parent. Which technical effect should its description include?

  1. Root variables accept runtime assignments, whereas a child module normally receives its inputs through the parent's module call.
  2. Default provider configurations can be inherited, while alternate aliases need explicit mapping and declared configuration aliases.
  3. Each module boundary needs an output passthrough because the root cannot directly access an arbitrary grandchild's private resources.
  4. A module block explicitly sets the child's declared input variables using arguments of matching names.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to understand which provider settings a child module can use from its parent, so it produces the behavior described. In contrast, parent-to-child argument passing serves a different goal: set a reusable module's environment tag from the caller, not understand which provider settings a child module can use from its parent.

Incorrect Answers

A:

The description applies to root input variable scope when an engineer needs to read command-line and tfvars input values for the root module; the named provider configuration inheritance instead handles the requirement to understand which provider settings a child module can use from its parent, so this behavior does not describe Provider configuration inheritance in the situation named.

C:

The description applies to nested module output propagation when an engineer needs to make a value from a grandchild module visible to the root module; the named provider configuration inheritance instead handles the requirement to understand which provider settings a child module can use from its parent, so this behavior does not describe Provider configuration inheritance in the situation named.

D:

The description applies to parent-to-child argument passing when an engineer needs to set a reusable module's environment tag from the caller; the named provider configuration inheritance instead handles the requirement to understand which provider settings a child module can use from its parent, so this behavior does not describe Provider configuration inheritance in the situation named.

Question 555

During an infrastructure design review about how to accept current remote readings into Terraform's state through an apply operation, a maintainer asks what “terraform apply -refresh-only” does. Which description is accurate?

  1. Manual state-file changes can break address mappings or serial consistency; commands such as state mv and moved blocks are safer.
  2. Refresh-only apply can update the recorded state to match observed remote attributes without modifying cloud resources.
  3. State metadata such as lineage and serial helps protect against incompatible or stale state updates.
  4. A removed block can intentionally forget the previous resource address without a provider delete when lifecycle destroy is false.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to accept current remote readings into Terraform's state through an apply operation, so it produces the behavior described. In contrast, serial and lineage checks serves a different goal: detect that a state snapshot belongs to a different history or older generation, not accept current remote readings into Terraform's state through an apply operation.

Incorrect Answers

A:

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 apply -refresh-only instead handles the requirement to accept current remote readings into Terraform's state through an apply operation, so this behavior does not describe terraform apply -refresh-only in the situation named.

C:

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 apply -refresh-only instead handles the requirement to accept current remote readings into Terraform's state through an apply operation, so this behavior does not describe terraform apply -refresh-only in the situation named.

D:

The description applies to a removed block with destroy=false when an engineer needs to declare that a resource should leave management while its actual object is retained; the named terraform apply -refresh-only instead handles the requirement to accept current remote readings into Terraform's state through an apply operation, so this behavior does not describe terraform apply -refresh-only in the situation named.

Question 556

The team evaluates “A provider mirror” for a requirement to install approved plugins from an internal distribution location. Which observed behavior belongs to that mechanism rather than a different Terraform feature?

  1. The pessimistic constraint ~> 5.3 permits version 5.3 and later releases below 6.0.0.
  2. The source address identifies a provider by registry hostname, namespace and type; local names alone are insufficient to distinguish publishers.
  3. A CLI provider_installation configuration can direct provider package discovery to a network or filesystem mirror.
  4. A constraint such as < 6.0.0 prevents selection of versions that reach the excluded release boundary.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to install approved plugins from an internal distribution location, so it produces the behavior described. In contrast, a major-series compatible constraint serves a different goal: accept minor and patch updates without crossing the next major version, not install approved plugins from an internal distribution location.

Incorrect Answers

A:

The description applies to a major-series compatible constraint when an engineer needs to accept minor and patch updates without crossing the next major version; the named a provider mirror instead handles the requirement to install approved plugins from an internal distribution location, so this behavior does not describe A provider mirror in the situation named.

B:

The description applies to a provider source address when an engineer needs to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name; the named a provider mirror instead handles the requirement to install approved plugins from an internal distribution location, so this behavior does not describe A provider mirror in the situation named.

D:

The description applies to an upper-bound provider constraint when an engineer needs to avoid using provider versions from a newer unsupported major release; the named a provider mirror instead handles the requirement to install approved plugins from an internal distribution location, so this behavior does not describe A provider mirror in the situation named.

Question 557

A runbook lists “Destroy plan risk review” for the task to identify which root-module-managed resources will be affected before a cleanup. Which technical effect should its description include?

  1. Providers and remote APIs can reject deletion when dependencies, protection flags or permissions prevent removing the object.
  2. Reviewing a destroy plan is essential because a command can remove every managed instance within the relevant state scope.
  3. Removing a state association, for example with terraform state rm, makes Terraform forget the object without asking the provider to delete it.
  4. Destroy planning shows the deletion proposal without carrying out the deletion until apply.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to identify which root-module-managed resources will be affected before a cleanup, so it produces the behavior described. In contrast, resource-specific delete restrictions serves a different goal: diagnose why destroy fails despite valid Terraform syntax, not identify which root-module-managed resources will be affected before a cleanup.

Incorrect Answers

A:

The description applies to resource-specific delete restrictions when an engineer needs to diagnose why destroy fails despite valid Terraform syntax; the named destroy plan risk review instead handles the requirement to identify which root-module-managed resources will be affected before a cleanup, so this behavior does not describe Destroy plan risk review in the situation named.

C:

The description applies to remove from state without deletion when an engineer needs to stop managing an existing object while preserving the real remote infrastructure; the named destroy plan risk review instead handles the requirement to identify which root-module-managed resources will be affected before a cleanup, so this behavior does not describe Destroy plan risk review in the situation named.

D:

The description applies to terraform plan -destroy when an engineer needs to review an all-destroy plan before approving resource deletion; the named destroy plan risk review instead handles the requirement to identify which root-module-managed resources will be affected before a cleanup, so this behavior does not describe Destroy plan risk review in the situation named.

Question 558

A change request asks an engineer to send the correct region-specific provider into a reusable child module. Which choice best implements the requested behavior?

  1. A module with count
  2. Module provider mappings
  3. Module-level depends_on
  4. Multiple calls to one module

Explanation

Correct Answer

B:

The providers map on the module call maps child provider names to selected provider configurations from the root module; this directly meets the requirement to send the correct region-specific provider into a reusable child module. By comparison, multiple calls to one module is intended to deploy two independently managed stacks from the same module definition, which is a different task from send the correct region-specific provider into a reusable child module.

Incorrect Answers

A:

The count meta-argument creates numerically indexed module instances such as module.worker[0]; this mechanism is useful when the job is to instantiate a fixed number of child module copies, whereas the current scenario requires the engineer to send the correct region-specific provider into a reusable child module. These operations have different effects in the stated Terraform workflow.

C:

depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency; this mechanism is useful when the job is to create an explicit ordering edge for module resources that have a real hidden dependency, whereas the current scenario requires the engineer to send the correct region-specific provider into a reusable child module. These operations have different effects in the stated Terraform workflow.

D:

Two module blocks that use the same source create separate module instances and separate resource addresses; this mechanism is useful when the job is to deploy two independently managed stacks from the same module definition, whereas the current scenario requires the engineer to send the correct region-specific provider into a reusable child module. These operations have different effects in the stated Terraform workflow.

Question 559

A Terraform reviewer encounters “Apply reviewed configuration” while assessing how to execute the approved set of infrastructure changes. Which statement correctly describes its actual behavior?

  1. The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage.
  2. Running terraform init configures backend access, child modules and required providers before plans can run.
  3. Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift.
  4. terraform apply invokes providers to carry out selected planned operations and updates state with their results.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to execute the approved set of infrastructure changes, so it produces the behavior described. In contrast, separate plan and apply privileges serves a different goal: require approval before an infrastructure change executes, not execute the approved set of infrastructure changes.

Incorrect Answers

A:

The description applies to write configuration first when an engineer needs to express the intended infrastructure before asking Terraform for a plan; the named apply reviewed configuration instead handles the requirement to execute the approved set of infrastructure changes, so this behavior does not describe Apply reviewed configuration in the situation named.

B:

This describes Initialize after checkout and its job to prepare a newly cloned root module for local Terraform operations, whereas the question asks about Apply reviewed configuration. The latter is the mechanism used to execute the approved set of infrastructure changes; the proposed effect belongs to a different Terraform feature.

C:

The description applies to check infrastructure after apply when an engineer needs to confirm deployed outputs and state match the expected result; the named apply reviewed configuration instead handles the requirement to execute the approved set of infrastructure changes, so this behavior does not describe Apply reviewed configuration in the situation named.

Question 560

A change request asks an engineer to connect reviewed repository commits to automated infrastructure plans. Which choice best implements the requested behavior?

  1. An API token for CLI connectivity
  2. HCP Terraform VCS integration
  3. A cloud workspaces tags setting
  4. terraform login

Explanation

Correct Answer

B:

A VCS-connected workspace coordinates code changes, speculative plans and controlled applies through supported repository integration; this directly meets the requirement to connect reviewed repository commits to automated infrastructure plans. By comparison, terraform login is intended to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname, which is a different task from connect reviewed repository commits to automated infrastructure plans.

Incorrect Answers

A:

The HCP service token controls platform API authentication and is distinct from provider credentials used to modify cloud infrastructure; this mechanism is useful when the job is to authorize a Terraform CLI workflow to access an HCP Terraform organization, whereas the current scenario requires the engineer to connect reviewed repository commits to automated infrastructure plans. These operations have different effects in the stated Terraform workflow.

C:

The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form; this mechanism is useful when the job is to select an HCP Terraform workspace collection by workspace tags, whereas the current scenario requires the engineer to connect reviewed repository commits to automated infrastructure plans. These operations have different effects in the stated Terraform workflow.

D:

The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate; this mechanism is useful when the job is to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname, whereas the current scenario requires the engineer to connect reviewed repository commits to automated infrastructure plans. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests