Question 370
A Terraform reviewer encounters “HCP Terraform sensitive workspace variables” while assessing how to avoid exposing a secret in ordinary workspace variable screens and logs. Which statement correctly describes its actual behavior?
- HCP Terraform can mark workspace variables sensitive to limit UI exposure, though sensitive flags do not replace secure state access.
- Vault's dynamic credentials can provide expiring access with centrally enforced policies instead of permanent embedded keys.
- Base64 is reversible encoding; exposing encoded credentials in configuration or state still risks disclosure.
- Protecting state requires backend encryption, identity-based authorization and controlled access because state can store raw secret values.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to avoid exposing a secret in ordinary workspace variable screens and logs, so it produces the behavior described. In contrast, not treating Base64 as secrecy serves a different goal: recognize that an encoded password remains sensitive information, not avoid exposing a secret in ordinary workspace variable screens and logs.
Incorrect Answers
B:The description applies to vault short-lived credentials when an engineer needs to limit the lifetime and scope of identities used by infrastructure automation; the named HCP Terraform sensitive workspace variables instead handles the requirement to avoid exposing a secret in ordinary workspace variable screens and logs, so this behavior does not describe HCP Terraform sensitive workspace variables in the situation named.
C:The description applies to not treating Base64 as secrecy when an engineer needs to recognize that an encoded password remains sensitive information; the named HCP Terraform sensitive workspace variables instead handles the requirement to avoid exposing a secret in ordinary workspace variable screens and logs, so this behavior does not describe HCP Terraform sensitive workspace variables in the situation named.
D:The description applies to remote state access controls when an engineer needs to prevent unauthorized operators from reading sensitive resource attributes; the named HCP Terraform sensitive workspace variables instead handles the requirement to avoid exposing a secret in ordinary workspace variable screens and logs, so this behavior does not describe HCP Terraform sensitive workspace variables in the situation named.
Question 371
During a design review, the requirement is to populate provider package checksums for selected platforms. Which option should the engineer select?
- A provider source address
- terraform init
- terraform providers lock
- A compatible provider constraint
Explanation
Correct Answer
C:The providers lock subcommand updates dependency lock information, including hashes for specified target operating-system platforms; this directly meets the requirement to populate provider package checksums for selected platforms. By comparison, a provider source address is intended to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name, which is a different task from populate provider package checksums for selected platforms.
Incorrect Answers
A:The source address identifies a provider by registry hostname, namespace and type; local names alone are insufficient to distinguish publishers; this mechanism is useful when the job is to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name, whereas the current scenario requires the engineer to populate provider package checksums for selected platforms. These operations have different effects in the stated Terraform workflow.
B:Initialization resolves provider requirements, installs plugins, and prepares modules and backend settings in the working directory; this mechanism is useful when the job is to download missing required provider plugins before planning, whereas the current scenario requires the engineer to populate provider package checksums for selected platforms. These operations have different effects in the stated Terraform workflow.
D:The pessimistic constraint ~> 5.3.0 admits versions at least 5.3.0 but below 5.4.0; this mechanism is useful when the job is to accept patch updates within a chosen minor line, whereas the current scenario requires the engineer to populate provider package checksums for selected platforms. These operations have different effects in the stated Terraform workflow.
Question 372
A team proposes “A refreshed changed resource” to stop Terraform from overwriting a field delegated to an external controller. If they proceed with that technique, which result should they anticipate instead?
- The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed.
- Import commands require the provider-defined identity format, not an arbitrary local Terraform block label.
- Configuration still describes the preferred value, so normal planning can propose undoing an out-of-band modification unless ignored.
- The state pull command retrieves state from the configured backend and prints a snapshot that may contain secrets.
Explanation
Correct Answer
C:A refreshed changed resource is used when an operator needs to understand why Terraform tries to reset a manually edited resource attribute. Consequently, this choice cannot meet the separate requirement to stop Terraform from overwriting a field delegated to an external controller. The intended action would instead require ignore_changes for shared ownership.
Incorrect Answers
A:That outcome belongs to ignore_changes for shared ownership, the mechanism that can stop Terraform from overwriting a field delegated to an external controller. The question concerns the engineer’s actual proposal, A refreshed changed resource; it is directed at understand why Terraform tries to reset a manually edited resource attribute, not that result.
B:This behavior belongs to Import IDs defined by providers, which helps engineers map an existing object's correct remote identifier to a Terraform address rather than satisfying the separate requirement to stop Terraform from overwriting a field delegated to an external controller. The attempted technique was A refreshed changed resource; it would instead be used to understand why Terraform tries to reset a manually edited resource attribute, not to produce the effect associated with Import IDs defined by providers.
D:This behavior belongs to terraform state pull, which helps engineers obtain the current state snapshot for inspection or controlled backup rather than satisfying the separate requirement to stop Terraform from overwriting a field delegated to an external controller. The attempted technique was A refreshed changed resource; it would instead be used to understand why Terraform tries to reset a manually edited resource attribute, not to produce the effect associated with terraform state pull.
Question 373
A build job for a Terraform configuration needs to skip backend initialization during a specialized init operation. Which feature or operation is the most direct match?
- Provider source change reinitialization
- terraform init -upgrade for modules
- terraform init -backend=false
- terraform init -migrate-state
Explanation
Correct Answer
C:The backend=false switch suppresses backend setup; commands needing backend access may then be unable to proceed; this directly meets the requirement to skip backend initialization during a specialized init operation. By comparison, provider source change reinitialization is intended to respond after changing the source address of a required provider, which is a different task from skip backend initialization during a specialized init operation.
Incorrect Answers
A:A modified provider requirement can trigger a need to rerun init to resolve the newly declared plugin dependency; this mechanism is useful when the job is to respond after changing the source address of a required provider, whereas the current scenario requires the engineer to skip backend initialization during a specialized init operation. These operations have different effects in the stated Terraform workflow.
B:Upgrade tells init to reconsider prior module selections instead of simply reusing previously installed versions; this mechanism is useful when the job is to fetch newer module releases permitted by version constraints, whereas the current scenario requires the engineer to skip backend initialization during a specialized init operation. These operations have different effects in the stated Terraform workflow.
D:The migrate-state flag attempts to copy prior state into the new backend and can prompt for migration confirmation; this mechanism is useful when the job is to move existing state to a newly configured backend, whereas the current scenario requires the engineer to skip backend initialization during a specialized init operation. These operations have different effects in the stated Terraform workflow.
Question 374
An engineer intends to prepare a folder containing fresh .tf configuration files and is reviewing “terraform init for a new directory”. What consequence follows from using it as intended?
- Terraform records provider version and checksum selections in its dependency lock file, which teams normally commit to source control.
- This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets.
- The get=false switch skips child module installation, which is generally safe only if module dependencies are already present.
- The migrate-state flag attempts to copy prior state into the new backend and can prompt for migration confirmation.
- A modified provider requirement can trigger a need to rerun init to resolve the newly declared plugin dependency.
- Initialization installs required providers and modules and establishes the working directory's backend configuration.
Explanation
Correct Answer
F:The named mechanism is used when the objective is to prepare a folder containing fresh .tf configuration files, so it produces the behavior described. In contrast, terraform init -get=false serves a different goal: avoid downloading child modules during a narrowly scoped initialization, not prepare a folder containing fresh .tf configuration files.
Incorrect Answers
A:The description applies to the .terraform.lock.hcl file when an engineer needs to identify which file should be checked in to preserve selected provider packages; the named terraform init for a new directory instead handles the requirement to prepare a folder containing fresh .tf configuration files, so this behavior does not describe terraform init for a new directory in the situation named.
B:The description applies to terraform init -backend-config when an engineer needs to inject partial backend settings at initialization time; the named terraform init for a new directory instead handles the requirement to prepare a folder containing fresh .tf configuration files, so this behavior does not describe terraform init for a new directory in the situation named.
C:The description applies to terraform init -get=false when an engineer needs to avoid downloading child modules during a narrowly scoped initialization; the named terraform init for a new directory instead handles the requirement to prepare a folder containing fresh .tf configuration files, so this behavior does not describe terraform init for a new directory in the situation named.
D:The description applies to terraform init -migrate-state when an engineer needs to move existing state to a newly configured backend; the named terraform init for a new directory instead handles the requirement to prepare a folder containing fresh .tf configuration files, so this behavior does not describe terraform init for a new directory in the situation named.
E:The description applies to provider source change reinitialization when an engineer needs to respond after changing the source address of a required provider; the named terraform init for a new directory instead handles the requirement to prepare a folder containing fresh .tf configuration files, so this behavior does not describe terraform init for a new directory in the situation named.
Question 375
A Terraform reviewer encounters “terraform init -backend-config” while assessing how to inject partial backend settings at initialization time. Which statement correctly describes its actual behavior?
- Terraform creates .terraform for module caches, provider installations and backend/workspace metadata; it is not a substitute for committed configuration.
- Initialization installs required providers and modules and establishes the working directory's backend configuration.
- This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets.
- terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to inject partial backend settings at initialization time, so it produces the behavior described. In contrast, terraform init for a new directory serves a different goal: prepare a folder containing fresh .tf configuration files, not inject partial backend settings at initialization time.
Incorrect Answers
A:The description applies to the .terraform directory when an engineer needs to identify where a working directory keeps installed modules and initialization metadata; the named terraform init -backend-config instead handles the requirement to inject partial backend settings at initialization time, so this behavior does not describe terraform init -backend-config in the situation named.
B:The description applies to terraform init for a new directory when an engineer needs to prepare a folder containing fresh .tf configuration files; the named terraform init -backend-config instead handles the requirement to inject partial backend settings at initialization time, so this behavior does not describe terraform init -backend-config in the situation named.
D:The description applies to repeatable initialization when an engineer needs to run initialization again in an already prepared directory without unnecessary changes; the named terraform init -backend-config instead handles the requirement to inject partial backend settings at initialization time, so this behavior does not describe terraform init -backend-config in the situation named.
Question 376
A Terraform reviewer encounters “Migrating state to HCP Terraform” while assessing how to move an established root configuration from local state into a managed HCP workspace. Which statement correctly describes its actual behavior?
- Dynamic credentials integrate HCP Terraform with supported identity federation to obtain scoped run credentials.
- Migration requires setting HCP Terraform integration and handling state transfer rather than starting a blank workspace against existing objects.
- The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form.
- The cloud hostname setting and login host identify the relevant service installation for organization operations.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to move an established root configuration from local state into a managed HCP workspace, so it produces the behavior described. In contrast, Terraform Enterprise hostname selection serves a different goal: connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, not move an established root configuration from local state into a managed HCP workspace.
Incorrect Answers
A:The description applies to dynamic provider credential integration when an engineer needs to grant HCP runs temporary cloud authorization instead of long-lived static secrets; the named migrating state to HCP Terraform instead handles the requirement to move an established root configuration from local state into a managed HCP workspace, so this behavior does not describe Migrating state to HCP Terraform in the situation named.
C:The description applies to a cloud workspaces tags setting when an engineer needs to select an HCP Terraform workspace collection by workspace tags; the named migrating state to HCP Terraform instead handles the requirement to move an established root configuration from local state into a managed HCP workspace, so this behavior does not describe Migrating state to HCP Terraform in the situation named.
D:The description applies to Terraform Enterprise hostname selection when an engineer needs to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io; the named migrating state to HCP Terraform instead handles the requirement to move an established root configuration from local state into a managed HCP workspace, so this behavior does not describe Migrating state to HCP Terraform in the situation named.
Question 377
A reusable infrastructure definition needs to require a named structure with typed attributes. Which feature or operation is the most direct match?
- toset conversion
- The null value
- An unknown plan-time value
- An object type
Explanation
Correct Answer
D:object({ name = string, size = number }) specifies per-attribute types for a structured input; this directly meets the requirement to require a named structure with typed attributes. By comparison, toset conversion is intended to deduplicate a collection of string identifiers for keyed iteration, which is a different task from require a named structure with typed attributes.
Incorrect Answers
A:toset converts a collection into a set; duplicate elements are removed and original positional ordering is not preserved; this mechanism is useful when the job is to deduplicate a collection of string identifiers for keyed iteration, whereas the current scenario requires the engineer to require a named structure with typed attributes. These operations have different effects in the stated Terraform workflow.
B:In supported contexts, setting an optional resource argument to null behaves like leaving that argument unset; this mechanism is useful when the job is to represent the absence of an optional argument value, whereas the current scenario requires the engineer to require a named structure with typed attributes. These operations have different effects in the stated Terraform workflow.
C:An unknown value represents future information and can propagate through expressions until a provider supplies the result; this mechanism is useful when the job is to identify a computed attribute that Terraform cannot determine until apply, whereas the current scenario requires the engineer to require a named structure with typed attributes. These operations have different effects in the stated Terraform workflow.
Question 378
A new Terraform working directory needs to configure two connections to the same service for different regions or accounts. Which feature or operation is the most direct match?
- The provider registry namespace
- Provider aliases
- Provider integrity hashes
- Provider version compatibility
Explanation
Correct Answer
B:A provider configuration with alias defines a named alternate that resources or modules can explicitly select; this directly meets the requirement to configure two connections to the same service for different regions or accounts. By comparison, provider integrity hashes is intended to detect a mismatched plugin distribution package, which is a different task from configure two connections to the same service for different regions or accounts.
Incorrect Answers
A:The namespace portion of a source address separates provider publishers in the registry; this mechanism is useful when the job is to identify the publisher when providers share a type name, whereas the current scenario requires the engineer to configure two connections to the same service for different regions or accounts. These operations have different effects in the stated Terraform workflow.
C:Terraform checks downloaded provider package checksums against lock information where hashes are available; this mechanism is useful when the job is to detect a mismatched plugin distribution package, whereas the current scenario requires the engineer to configure two connections to the same service for different regions or accounts. These operations have different effects in the stated Terraform workflow.
D:Version constraints and a shared lock file reduce unintended schema and behavior changes between deployments; this mechanism is useful when the job is to prevent incompatible provider upgrades from affecting resource handling, whereas the current scenario requires the engineer to configure two connections to the same service for different regions or accounts. These operations have different effects in the stated Terraform workflow.
Question 379
A reusable infrastructure definition requires a way to read the per-instance map value when iterating with for_each. Which Terraform approach most directly fulfills that request?
- A for_each instance address
- Output dependency metadata
- each.value
- A variable reference
- An implicit attribute dependency
- Explicit depends_on
Explanation
Correct Answer
C:For a map-based for_each collection, each.value exposes the value associated with the current each.key; this directly meets the requirement to read the per-instance map value when iterating with for_each. By comparison, an implicit attribute dependency is intended to ensure a dependent resource waits for the object whose ID it needs, which is a different task from read the per-instance map value when iterating with for_each.
Incorrect Answers
A:Instances made from a map or string set have addresses such as aws_instance.web["blue"], rather than an integer count index; this mechanism is useful when the job is to identify a single managed object selected by a string key, whereas the current scenario requires the engineer to read the per-instance map value when iterating with for_each. These operations have different effects in the stated Terraform workflow.
B:An output block can use depends_on for dependencies that are not evident from its value expression; this mechanism is useful when the job is to delay the visibility of an output until additional required operations finish, whereas the current scenario requires the engineer to read the per-instance map value when iterating with for_each. These operations have different effects in the stated Terraform workflow.
D:var.NAME reads a declared input variable in the module where the variable block is defined; this mechanism is useful when the job is to inject a caller-supplied input into a resource argument, whereas the current scenario requires the engineer to read the per-instance map value when iterating with for_each. These operations have different effects in the stated Terraform workflow.
E:Referencing another managed resource's attribute creates an implicit dependency in Terraform's graph; this mechanism is useful when the job is to ensure a dependent resource waits for the object whose ID it needs, whereas the current scenario requires the engineer to read the per-instance map value when iterating with for_each. These operations have different effects in the stated Terraform workflow.
F:The depends_on meta-argument adds dependency edges for a known relationship that Terraform cannot otherwise infer; this mechanism is useful when the job is to order resources when there is a dependency not expressed by attribute references, whereas the current scenario requires the engineer to read the per-instance map value when iterating with for_each. These operations have different effects in the stated Terraform workflow.
Question 380
A team proposes “A default provider configuration” to pass an aliased provider configuration into a child module. If they proceed with that technique, which result should they anticipate instead?
- List both plugins under required_providers and configure each service's provider independently as needed.
- The required_providers entry maps the chosen local name to a specific fully qualified provider source address.
- An unaliased provider block configures the default instance used by matching resources that do not override provider selection.
- The module call's providers argument maps the child's expected provider configuration name to a provider configuration available in the parent.
Explanation
Correct Answer
C:A default provider configuration is used when an operator needs to make resources use a common account without an explicit provider argument. Consequently, this choice cannot meet the separate requirement to pass an aliased provider configuration into a child module. The intended action would instead require The providers map on a module call.
Incorrect Answers
A:This behavior belongs to Separate required provider names, which helps engineers use two unrelated service APIs in one root configuration rather than satisfying the separate requirement to pass an aliased provider configuration into a child module. The attempted technique was A default provider configuration; it would instead be used to make resources use a common account without an explicit provider argument, not to produce the effect associated with Separate required provider names.
B:This behavior belongs to Provider-local name mapping, which helps engineers reuse a provider whose source address differs from its short local identifier rather than satisfying the separate requirement to pass an aliased provider configuration into a child module. The attempted technique was A default provider configuration; it would instead be used to make resources use a common account without an explicit provider argument, not to produce the effect associated with Provider-local name mapping.
D:That outcome belongs to The providers map on a module call, the mechanism that can pass an aliased provider configuration into a child module. The question concerns the engineer’s actual proposal, A default provider configuration; it is directed at make resources use a common account without an explicit provider argument, not that result.