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

Question 350

A Terraform reviewer encounters “terraform init -reconfigure” while assessing how to switch backend settings without performing automatic state migration. Which statement correctly describes its actual behavior?

  1. Backend config arguments supplied at init time fill required values, but sensitive content can still be cached in local metadata or plans.
  2. The reconfigure flag discards cached previous backend settings and does not copy the prior state snapshot.
  3. The S3 backend uses configured bucket and key settings, plus suitable authentication and optional locking support.
  4. Encryption is controlled by the chosen backend service; Terraform's remote backend abstraction does not supply one universal encryption mechanism.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to switch backend settings without performing automatic state migration, so it produces the behavior described. In contrast, the S3 backend serves a different goal: store Terraform state as an object in an S3 bucket, not switch backend settings without performing automatic state migration.

Incorrect Answers

A:

The description applies to partial backend configuration when an engineer needs to provide environment-specific backend details at initialization rather than hard-coding them; the named terraform init -reconfigure instead handles the requirement to switch backend settings without performing automatic state migration, so this behavior does not describe terraform init -reconfigure in the situation named.

C:

The description applies to the S3 backend when an engineer needs to store Terraform state as an object in an S3 bucket; the named terraform init -reconfigure instead handles the requirement to switch backend settings without performing automatic state migration, so this behavior does not describe terraform init -reconfigure in the situation named.

D:

The description applies to remote state encryption at rest when an engineer needs to protect stored state contents from unauthorized storage-layer access; the named terraform init -reconfigure instead handles the requirement to switch backend settings without performing automatic state migration, so this behavior does not describe terraform init -reconfigure in the situation named.

Question 351

An engineering checklist calls for separate outcomes: (1) copy a known working state's snapshot into a new configured backend; (2) choose where a root deployment's state will be stored. Which TWO options implement the requested outcomes? Choose TWO.

  1. Remote backend access permissions
  2. Backend state key separation
  3. Backend configuration only in a root module
  4. terraform init -migrate-state
  5. The terraform.tfstate file

Explanation

Correct Answers

C:

Backend configuration is evaluated for the root module; defining backend settings inside reusable child modules does not give them separate state; this meets the requirement to choose where a root deployment's state will be stored, while the other selected techniques address copy a known working state's snapshot into a new configured backend, which require their own distinct Terraform mechanisms.

D:

After changing backend configuration, migrate-state attempts to transfer existing state instead of starting with an empty one; this meets the requirement to copy a known working state's snapshot into a new configured backend, while the other selected techniques address choose where a root deployment's state will be stored, which require their own distinct Terraform mechanisms.

Incorrect Answers

A:

Cloud storage policy and backend authorization decide who can obtain or mutate stored Terraform state; provider credentials alone are not sufficient; it addresses enforce read and write privileges on the state object, but this delivery instead requires copy a known working state's snapshot into a new configured backend and choose where a root deployment's state will be stored. The required combination involves Backend configuration only in a root module and terraform init -migrate-state, not the behavior of Remote backend access permissions.

B:

Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot; it addresses store different applications' state snapshots at distinct object paths, but this delivery instead requires copy a known working state's snapshot into a new configured backend and choose where a root deployment's state will be stored. The required combination involves Backend configuration only in a root module and terraform init -migrate-state, not the behavior of Backend state key separation.

E:

The default workspace's local state is kept as terraform.tfstate; this file may contain sensitive infrastructure details; it addresses identify Terraform's default local state artifact, but this delivery instead requires copy a known working state's snapshot into a new configured backend and choose where a root deployment's state will be stored. The required combination involves Backend configuration only in a root module and terraform init -migrate-state, not the behavior of The terraform.tfstate file.

Question 352

A Terraform change proposal names “The provider block” to configure API connection settings for an already required provider. Which outcome can reviewers attribute to that particular mechanism?

  1. A provider block can configure an endpoint, region or authentication parameters but should not carry the provider's version constraint.
  2. Terraform generally selects the default provider matching a resource's type prefix unless an alternate configuration is specified.
  3. Terraform checks downloaded provider package checksums against lock information where hashes are available.
  4. Providers implement resource and data-source schemas plus read, create, update and delete operations for their services.
  5. Terraform Core handles language evaluation, planning and state orchestration while provider plugins execute service-specific operations.

Explanation

Correct Answer

A:

The named mechanism is used when the objective is to configure API connection settings for an already required provider, so it produces the behavior described. In contrast, implicit provider selection serves a different goal: use the default provider configuration for a resource type, not configure API connection settings for an already required provider.

Incorrect Answers

B:

The description applies to implicit provider selection when an engineer needs to use the default provider configuration for a resource type; the named the provider block instead handles the requirement to configure API connection settings for an already required provider, so this behavior does not describe The provider block in the situation named.

C:

The description applies to provider integrity hashes when an engineer needs to detect a mismatched plugin distribution package; the named the provider block instead handles the requirement to configure API connection settings for an already required provider, so this behavior does not describe The provider block in the situation named.

D:

The description applies to a provider plugin when an engineer needs to translate Terraform resource operations into calls to the relevant remote API; the named the provider block instead handles the requirement to configure API connection settings for an already required provider, so this behavior does not describe The provider block in the situation named.

E:

The description applies to Terraform Core when an engineer needs to evaluate HCL expressions and calculate a resource dependency graph; the named the provider block instead handles the requirement to configure API connection settings for an already required provider, so this behavior does not describe The provider block in the situation named.

Question 353

A change request asks an engineer to link an output from one service to a dependent resource on another service. Which choice best implements the requested behavior?

  1. Isolating deployment boundaries
  2. Hybrid infrastructure provisioning
  3. Cross-provider references
  4. Provider-specific capabilities

Explanation

Correct Answer

C:

An attribute reference between resource instances can create a dependency across provider boundaries; this directly meets the requirement to link an output from one service to a dependent resource on another service. By comparison, provider-specific capabilities is intended to avoid assuming that all providers expose identical resource types and options, which is a different task from link an output from one service to a dependent resource on another service.

Incorrect Answers

A:

Separate root modules and state files reduce shared-plan scope when different teams or lifecycles require isolation; this mechanism is useful when the job is to limit the impact of changes to one environment or platform, whereas the current scenario requires the engineer to link an output from one service to a dependent resource on another service. These operations have different effects in the stated Terraform workflow.

B:

Providers can represent both on-premises platforms and cloud services as Terraform-managed resources in one workflow; this mechanism is useful when the job is to coordinate an on-premises platform with public-cloud resources, whereas the current scenario requires the engineer to link an output from one service to a dependent resource on another service. These operations have different effects in the stated Terraform workflow.

D:

A shared Terraform language does not erase provider API differences; each provider defines supported resource schemas and behavior; this mechanism is useful when the job is to avoid assuming that all providers expose identical resource types and options, whereas the current scenario requires the engineer to link an output from one service to a dependent resource on another service. These operations have different effects in the stated Terraform workflow.

Question 354

A team compares Terraform mechanisms for the goal to retrieve child modules without running the complete backend and provider setup steps. Which stated consequence belongs specifically to “terraform get”?

  1. A git::https:// source can retrieve a Terraform module from version control rather than from the module registry.
  2. A module source such as ./modules/network points to a local directory and requires no registry download or semantic version selection.
  3. The terraform get command updates downloaded module sources only; routine workflows generally prefer terraform init.
  4. Keeping reusable child modules separately versioned allows independent adoption and maintenance by different Terraform root modules.

Explanation

Correct Answer

C:

The named mechanism is used when the objective is to retrieve child modules without running the complete backend and provider setup steps, so it produces the behavior described. In contrast, a relative local module source serves a different goal: reuse a neighboring module directory in the same repository, not retrieve child modules without running the complete backend and provider setup steps.

Incorrect Answers

A:

The description applies to a Git HTTPS module source when an engineer needs to fetch module code directly from a remote Git repository; the named terraform get instead handles the requirement to retrieve child modules without running the complete backend and provider setup steps, so this behavior does not describe terraform get in the situation named.

B:

The description applies to a relative local module source when an engineer needs to reuse a neighboring module directory in the same repository; the named terraform get instead handles the requirement to retrieve child modules without running the complete backend and provider setup steps, so this behavior does not describe terraform get in the situation named.

D:

The description applies to a separate module repository when an engineer needs to share reusable Terraform configuration with multiple root projects; the named terraform get instead handles the requirement to retrieve child modules without running the complete backend and provider setup steps, so this behavior does not describe terraform get in the situation named.

Question 355

A team compares Terraform mechanisms for the goal to execute exactly the plan artifact that was reviewed. Which stated consequence belongs specifically to “Apply a saved plan”?

  1. The -input=false option prevents prompts for missing input, requiring all necessary values and approvals to be handled by automation.
  2. Passing the saved plan file to terraform apply uses its recorded choices; applying a plan file does not start a new interactive replanning step.
  3. A partial apply may have changed some resources, so Terraform should refresh and build a new plan rather than blindly assuming a full rollback.
  4. Provider API operations use the provider's configured credentials or supported ambient authentication, not the login name in a commit.

Explanation

Correct Answer

B:

The named mechanism is used when the objective is to execute exactly the plan artifact that was reviewed, so it produces the behavior described. In contrast, apply failure recovery serves a different goal: inspect state and re-plan when a provider operation fails partway through, not execute exactly the plan artifact that was reviewed.

Incorrect Answers

A:

The description applies to noninteractive apply settings when an engineer needs to run Terraform in automation where prompting is not acceptable; the named apply a saved plan instead handles the requirement to execute exactly the plan artifact that was reviewed, so this behavior does not describe Apply a saved plan in the situation named.

C:

The description applies to apply failure recovery when an engineer needs to inspect state and re-plan when a provider operation fails partway through; the named apply a saved plan instead handles the requirement to execute exactly the plan artifact that was reviewed, so this behavior does not describe Apply a saved plan in the situation named.

D:

The description applies to apply using current credentials when an engineer needs to determine which identity actually performs infrastructure changes; the named apply a saved plan instead handles the requirement to execute exactly the plan artifact that was reviewed, so this behavior does not describe Apply a saved plan in the situation named.

Question 356

A change request asks an engineer to allow independent resources to be applied concurrently. Which choice best implements the requested behavior?

  1. terraform apply -auto-approve
  2. Refresh during apply planning
  3. terraform apply
  4. Parallel graph execution

Explanation

Correct Answer

D:

Terraform executes actions in graph order and can operate on independent nodes in parallel subject to provider and CLI limits; this directly meets the requirement to allow independent resources to be applied concurrently. By comparison, refresh during apply planning is intended to avoid applying from stale remembered attributes after remote drift, which is a different task from allow independent resources to be applied concurrently.

Incorrect Answers

A:

The auto-approve option allows the automatically created plan to proceed without interactive confirmation, so pipeline safeguards matter; this mechanism is useful when the job is to suppress Terraform's normal approval prompt in a controlled pipeline, whereas the current scenario requires the engineer to allow independent resources to be applied concurrently. These operations have different effects in the stated Terraform workflow.

B:

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 allow independent resources to be applied concurrently. These operations have different effects in the stated Terraform workflow.

C:

Applying a configuration obtains a plan, requests approval when appropriate and invokes provider operations to change objects and state; this mechanism is useful when the job is to make Terraform execute the planned operations against managed infrastructure, whereas the current scenario requires the engineer to allow independent resources to be applied concurrently. These operations have different effects in the stated Terraform workflow.

Question 357

A multi-provider deployment design needs to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. Which feature or operation is the most direct match?

  1. A lower-bound provider constraint
  2. An upper-bound provider constraint
  3. A provider source address
  4. terraform init -upgrade

Explanation

Correct Answer

C:

The source address identifies a provider by registry hostname, namespace and type; local names alone are insufficient to distinguish publishers; this directly meets the requirement to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. By comparison, an upper-bound provider constraint is intended to avoid using provider versions from a newer unsupported major release, which is a different task from distinguish a community plugin from the HashiCorp-maintained plugin with the same local name.

Incorrect Answers

A:

A version requirement such as >= 5.0.0 allows matching later versions but does not cap major-version upgrades; this mechanism is useful when the job is to allow provider releases no older than a tested minimum, whereas the current scenario requires the engineer to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. These operations have different effects in the stated Terraform workflow.

B:

A constraint such as < 6.0.0 prevents selection of versions that reach the excluded release boundary; this mechanism is useful when the job is to avoid using provider versions from a newer unsupported major release, whereas the current scenario requires the engineer to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. These operations have different effects in the stated Terraform workflow.

D:

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 distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. These operations have different effects in the stated Terraform workflow.

Question 358

A module author evaluates the expression upper("staging") with the literal inputs shown. What is the resulting Terraform value?

  1. "Staging" (initial-capital text)
  2. "STAGING" (uppercase text)
  3. "staging" (unchanged lowercase text)
  4. ["STAGING"]

Explanation

Correct Answer

B:

The expression upper("staging") evaluates to "STAGING" because upper converts each alphabetic character in the string to uppercase. This is Terraform's direct evaluation of the supplied literal arguments in upper("staging"), not an external provider lookup.

Incorrect Answers

A:

Only initial capitalization is not the requested all-uppercase transformation. In this specific evaluation, upper converts each alphabetic character in the string to uppercase, which rules out the proposed alternative.

C:

The input is not left unchanged after conversion. For upper("staging"), upper converts each alphabetic character in the string to uppercase; consequently this candidate is not the value Terraform computes.

D:

The function returns a string, not a one-element list. HCL evaluates upper("staging") using the supplied arguments: upper converts each alphabetic character in the string to uppercase; the listed result is therefore incorrect.

Question 359

A Terraform reviewer encounters “The coalesce function” while assessing how to pick the first non-null and nonempty string among candidate values. Which statement correctly describes its actual behavior?

  1. cidrsubnet derives a subnet CIDR using additional prefix bits and a network number, without provisioning a network resource.
  2. dynamic constructs blocks required by resource schemas; it does not create standalone Terraform resource declarations.
  3. upper transforms the letters of a string into uppercase without changing its underlying Terraform type.
  4. coalesce returns the first usable argument after skipping null or empty strings; it is not a boolean operator.

Explanation

Correct Answer

D:

The named mechanism is used when the objective is to pick the first non-null and nonempty string among candidate values, so it produces the behavior described. In contrast, the cidrsubnet function serves a different goal: calculate a nested network prefix from a parent CIDR range, not pick the first non-null and nonempty string among candidate values.

Incorrect Answers

A:

The description applies to the cidrsubnet function when an engineer needs to calculate a nested network prefix from a parent CIDR range; the named the coalesce function instead handles the requirement to pick the first non-null and nonempty string among candidate values, so this behavior does not describe The coalesce function in the situation named.

B:

The description applies to the dynamic block when an engineer needs to generate repeated nested blocks from a collection; the named the coalesce function instead handles the requirement to pick the first non-null and nonempty string among candidate values, so this behavior does not describe The coalesce function in the situation named.

C:

The description applies to the upper function when an engineer needs to convert an environment label to uppercase; the named the coalesce function instead handles the requirement to pick the first non-null and nonempty string among candidate values, so this behavior does not describe The coalesce function in the situation named.

Question 360

A Terraform module author requires a way to replace one managed resource when another managed resource's attribute changes. Which Terraform approach most directly fulfills that request?

  1. Output-level depends_on
  2. replace_triggered_by
  3. Dependency cycle resolution
  4. An implicit dependency through an ID

Explanation

Correct Answer

B:

This lifecycle rule uses planned resource actions as triggers for replacement and is not a general-purpose dependency selector; this directly meets the requirement to replace one managed resource when another managed resource's attribute changes. By comparison, dependency cycle resolution is intended to correct a pair of modules that each require the other's output to initialize, which is a different task from replace one managed resource when another managed resource's attribute changes.

Incorrect Answers

A:

An output block can express an explicit dependency beyond references contained in its value expression; this mechanism is useful when the job is to prevent a module output from being considered ready before an additional side-effect resource, whereas the current scenario requires the engineer to replace one managed resource when another managed resource's attribute changes. These operations have different effects in the stated Terraform workflow.

C:

Dependency cycles cannot be topologically ordered and require restructuring the relationships or splitting responsibilities; this mechanism is useful when the job is to correct a pair of modules that each require the other's output to initialize, whereas the current scenario requires the engineer to replace one managed resource when another managed resource's attribute changes. These operations have different effects in the stated Terraform workflow.

D:

Using the network object's ID in the subnet argument automatically creates a dependency edge in the graph; this mechanism is useful when the job is to make a subnet wait for the network resource it references, whereas the current scenario requires the engineer to replace one managed resource when another managed resource's attribute changes. These operations have different effects in the stated Terraform workflow.

HashiCorp Certified: Terraform Associate (Terraform Associate) Practice Tests