Question 460
A Terraform runbook prescribes “Remote state sharing boundaries” to preserve Terraform's knowledge of managed infrastructure between CLI runs, but it does not meet the requirement. What does that step actually accomplish?
- State can retain dependency information needed to correctly destroy objects no longer declared in configuration.
- The state snapshot records managed instance data and metadata needed to plan future actions.
- Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure.
- State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter.
Explanation
Correct Answer
C:Remote state sharing boundaries is used when an operator needs to avoid exposing full state when another stack only needs a published identifier. Consequently, this choice cannot meet the separate requirement to preserve Terraform's knowledge of managed infrastructure between CLI runs. The intended action would instead require State snapshots.
Incorrect Answers
A:This behavior belongs to State-backed dependency links, which helps engineers maintain dependencies for resources that have been removed from configuration rather than satisfying the separate requirement to preserve Terraform's knowledge of managed infrastructure between CLI runs. The attempted technique was Remote state sharing boundaries; it would instead be used to avoid exposing full state when another stack only needs a published identifier, not to produce the effect associated with State-backed dependency links.
B:That outcome belongs to State snapshots, the mechanism that can preserve Terraform's knowledge of managed infrastructure between CLI runs. The question concerns the engineer’s actual proposal, Remote state sharing boundaries; it is directed at avoid exposing full state when another stack only needs a published identifier, not that result.
D:This behavior belongs to State access protection, which helps engineers treat a Terraform state file as potentially sensitive data rather than satisfying the separate requirement to preserve Terraform's knowledge of managed infrastructure between CLI runs. The attempted technique was Remote state sharing boundaries; it would instead be used to avoid exposing full state when another stack only needs a published identifier, not to produce the effect associated with State access protection.
Question 461
In a Terraform configuration, what value does the HCL expression length(["dev", "prod", "qa"]) evaluate to?
- 9
- 3
- 2
- 4
Explanation
Correct Answer
B:The expression length(["dev", "prod", "qa"]) evaluates to 3 because the list contains three elements, regardless of how many characters each element has. This is Terraform's direct evaluation of the supplied literal arguments in length(["dev", "prod", "qa"]), not an external provider lookup.
Incorrect Answers
A:It appears to mix up element counting with a character count. HCL evaluates length(["dev", "prod", "qa"]) using the supplied arguments: the list contains three elements, regardless of how many characters each element has; the listed result is therefore incorrect.
C:It would omit one of the three list members. In this specific evaluation, the list contains three elements, regardless of how many characters each element has, which rules out the proposed alternative.
D:It would count an additional element that does not exist in the list. For length(["dev", "prod", "qa"]), the list contains three elements, regardless of how many characters each element has; consequently this candidate is not the value Terraform computes.
Question 462
During an infrastructure design review about how to enforce a reusable module's own input contract, a maintainer asks what “Variable validation inside a module” does. Which description is accurate?
- Each module boundary needs an output passthrough because the root cannot directly access an arbitrary grandchild's private resources.
- Variables declared by a child module belong to that module and receive values via the caller's module block.
- A child module may validate its input variables using conditions and errors independent of the parent's variable definitions.
- A child output can be marked sensitive, but its underlying value may still reside in state unless it uses permitted ephemeral handling.
- Each call has its own variable assignments and resource instances, even when both calls reference the same module source directory.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to enforce a reusable module's own input contract, so it produces the behavior described. In contrast, child input variable scope serves a different goal: make a setting available inside a called module without creating a global variable, not enforce a reusable module's own input contract.
Incorrect Answers
A: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 variable validation inside a module instead handles the requirement to enforce a reusable module's own input contract, so this behavior does not describe Variable validation inside a module in the situation named.
B:The description applies to child input variable scope when an engineer needs to make a setting available inside a called module without creating a global variable; the named variable validation inside a module instead handles the requirement to enforce a reusable module's own input contract, so this behavior does not describe Variable validation inside a module in the situation named.
D:The description applies to child module outputs and sensitivity when an engineer needs to limit ordinary display of a sensitive result exported from a reusable module; the named variable validation inside a module instead handles the requirement to enforce a reusable module's own input contract, so this behavior does not describe Variable validation inside a module in the situation named.
E:The description applies to different values for two module calls when an engineer needs to instantiate the same module with distinct environment inputs; the named variable validation inside a module instead handles the requirement to enforce a reusable module's own input contract, so this behavior does not describe Variable validation inside a module in the situation named.
Question 463
A team onboarding previously deployed infrastructure has a concrete implementation goal: specify which resource instance address should receive the imported object. What is the most appropriate Terraform mechanism?
- The import block
- An import block's to argument
- Separate resources for separate imports
- An import configuration review
Explanation
Correct Answer
B:The to argument points to an intended Terraform resource address rather than a provider account name or state backend; this directly meets the requirement to specify which resource instance address should receive the imported object. By comparison, separate resources for separate imports is intended to avoid attaching two remote objects to the same Terraform resource address, which is a different task from specify which resource instance address should receive the imported object.
Incorrect Answers
A:A top-level import block identifies a target resource address and import identity so the operation participates in plan and apply; this mechanism is useful when the job is to declare a managed import operation in configuration for planning and applying, whereas the current scenario requires the engineer to specify which resource instance address should receive the imported object. These operations have different effects in the stated Terraform workflow.
C:Each managed remote object should have its own appropriate resource instance address so state can map objects unambiguously; this mechanism is useful when the job is to avoid attaching two remote objects to the same Terraform resource address, whereas the current scenario requires the engineer to specify which resource instance address should receive the imported object. These operations have different effects in the stated Terraform workflow.
D:Generated resource declarations are a starting point and can include computed or unsuitable attributes requiring manual cleanup; this mechanism is useful when the job is to correct provider-generated HCL rather than trusting every inferred argument, whereas the current scenario requires the engineer to specify which resource instance address should receive the imported object. These operations have different effects in the stated Terraform workflow.
Question 464
A Terraform reviewer encounters “HCP Terraform run serialization” while assessing how to avoid multiple infrastructure applies targeting the same shared HCP workspace state. Which statement correctly describes its actual behavior?
- A state backend with locking helps serialize competing changes, complemented by pipeline approval and run coordination.
- HCP Terraform coordinates workspace runs and state handling, reducing conflicts among collaborating operators.
- Terraform uses lock information to distinguish a specific operation's lock from unrelated lock holders.
- A lock may belong to another active run, so check its identity and run status rather than immediately forcing removal.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to avoid multiple infrastructure applies targeting the same shared HCP workspace state, so it produces the behavior described. In contrast, state consistency during CI serves a different goal: keep two pipelines from changing the same infrastructure state simultaneously, not avoid multiple infrastructure applies targeting the same shared HCP workspace state.
Incorrect Answers
A:The description applies to state consistency during CI when an engineer needs to keep two pipelines from changing the same infrastructure state simultaneously; the named HCP Terraform run serialization instead handles the requirement to avoid multiple infrastructure applies targeting the same shared HCP workspace state, so this behavior does not describe HCP Terraform run serialization in the situation named.
C:The description applies to a lock identifier when an engineer needs to ensure a force-unlock targets the correct held state lock; the named HCP Terraform run serialization instead handles the requirement to avoid multiple infrastructure applies targeting the same shared HCP workspace state, so this behavior does not describe HCP Terraform run serialization in the situation named.
D:The description applies to lock ownership verification when an engineer needs to confirm that a held lock is stale before attempting manual removal; the named HCP Terraform run serialization instead handles the requirement to avoid multiple infrastructure applies targeting the same shared HCP workspace state, so this behavior does not describe HCP Terraform run serialization in the situation named.
Question 465
During an infrastructure design review about how to declare the backend type and settings used to store root-module state, a maintainer asks what “A terraform backend block” does. Which description is accurate?
- Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot.
- A terraform { backend "TYPE" {} } declaration selects state storage; its settings are initialized separately from provider configuration.
- Backend config arguments supplied at init time fill required values, but sensitive content can still be cached in local metadata or plans.
- 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 declare the backend type and settings used to store root-module state, so it produces the behavior described. In contrast, backend state key separation serves a different goal: store different applications' state snapshots at distinct object paths, not declare the backend type and settings used to store root-module state.
Incorrect Answers
A:The description applies to backend state key separation when an engineer needs to store different applications' state snapshots at distinct object paths; the named a terraform backend block instead handles the requirement to declare the backend type and settings used to store root-module state, so this behavior does not describe A terraform backend block in the situation named.
C: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 a terraform backend block instead handles the requirement to declare the backend type and settings used to store root-module state, so this behavior does not describe A terraform backend block 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 a terraform backend block instead handles the requirement to declare the backend type and settings used to store root-module state, so this behavior does not describe A terraform backend block in the situation named.
Question 466
During one infrastructure delivery, the team must satisfy all of the following: (1) supply a configuration input or environment value for HCP Terraform runs; (2) configure the local working directory to connect with the selected HCP workspace. Select TWO appropriate Terraform approaches. Choose TWO.
- A workspace variable
- HCP Terraform execution agents
- terraform init after adding cloud integration
- A run apply phase
- Workspace outputs
- HCP Terraform run tasks integration
Explanation
Correct Answers
A:HCP Terraform workspaces can hold Terraform input variables and environment variables for run-time use; this meets the requirement to supply a configuration input or environment value for HCP Terraform runs, while the other selected techniques address configure the local working directory to connect with the selected HCP workspace, which require their own distinct Terraform mechanisms.
C:Running init processes the cloud block and configures workspace connectivity before plans or applies; this meets the requirement to configure the local working directory to connect with the selected HCP workspace, while the other selected techniques address supply a configuration input or environment value for HCP Terraform runs, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:HCP Terraform agents can execute runs in customer-controlled networking while integrating with service orchestration; it addresses run Terraform in a private network where hosted workers cannot reach internal endpoints, but this delivery instead requires supply a configuration input or environment value for HCP Terraform runs and configure the local working directory to connect with the selected HCP workspace. The required combination involves A workspace variable and terraform init after adding cloud integration, not the behavior of HCP Terraform execution agents.
D:HCP Terraform can run the apply stage after its configured approval, policy and workflow requirements are satisfied; it addresses execute approved resource changes within an HCP Terraform workspace, but this delivery instead requires supply a configuration input or environment value for HCP Terraform runs and configure the local working directory to connect with the selected HCP workspace. The required combination involves A workspace variable and terraform init after adding cloud integration, not the behavior of A run apply phase.
E:Workspace output values come from root module output blocks and can be consumed through supported interfaces; it addresses publish selected values produced by an HCP Terraform run, but this delivery instead requires supply a configuration input or environment value for HCP Terraform runs and configure the local working directory to connect with the selected HCP workspace. The required combination involves A workspace variable and terraform init after adding cloud integration, not the behavior of Workspace outputs.
F:Run tasks integrate external systems into workflow checkpoints without changing the Terraform resource graph directly; it addresses send proposed changes to a third-party quality or security check service, but this delivery instead requires supply a configuration input or environment value for HCP Terraform runs and configure the local working directory to connect with the selected HCP workspace. The required combination involves A workspace variable and terraform init after adding cloud integration, not the behavior of HCP Terraform run tasks integration.
Question 467
A Terraform change proposal names “Removing a resource declaration” to plan to delete a previously managed object that remains in state. Which outcome can reviewers attribute to that particular mechanism?
- The built-in terraform_data resource can represent input changes and trigger replacement behavior without managing a cloud API resource.
- A provider data source can resolve the zone ID for use in managed records while the zone itself remains outside that configuration's resource lifecycle.
- When a managed resource is absent from configuration but still tracked in state, normal planning proposes its destruction.
- A resource block represents an object Terraform manages through a provider, with its identity and attributes tracked in state.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to plan to delete a previously managed object that remains in state, so it produces the behavior described. In contrast, data sources as external lookups serves a different goal: use an existing DNS zone from a provider without taking ownership of the zone, not plan to delete a previously managed object that remains in state.
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 removing a resource declaration instead handles the requirement to plan to delete a previously managed object that remains in state, so this behavior does not describe Removing a resource declaration in the situation named.
B:The description applies to data sources as external lookups when an engineer needs to use an existing DNS zone from a provider without taking ownership of the zone; the named removing a resource declaration instead handles the requirement to plan to delete a previously managed object that remains in state, so this behavior does not describe Removing a resource declaration in the situation named.
D:The description applies to a managed resource block when an engineer needs to declare that Terraform should create and maintain a new infrastructure object; the named removing a resource declaration instead handles the requirement to plan to delete a previously managed object that remains in state, so this behavior does not describe Removing a resource declaration in the situation named.
Question 468
During an infrastructure design review about how to avoid downloading child modules during a narrowly scoped initialization, a maintainer asks what “terraform init -get=false” does. Which description is accurate?
- terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup.
- Terraform records provider version and checksum selections in its dependency lock file, which teams normally commit to source control.
- 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.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to avoid downloading child modules during a narrowly scoped initialization, so it produces the behavior described. In contrast, the .terraform.lock.hcl file serves a different goal: identify which file should be checked in to preserve selected provider packages, not avoid downloading child modules during a narrowly scoped initialization.
Incorrect Answers
A: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 -get=false instead handles the requirement to avoid downloading child modules during a narrowly scoped initialization, so this behavior does not describe terraform init -get=false in the situation named.
B: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 -get=false instead handles the requirement to avoid downloading child modules during a narrowly scoped initialization, so this behavior does not describe terraform init -get=false 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 -get=false instead handles the requirement to avoid downloading child modules during a narrowly scoped initialization, so this behavior does not describe terraform init -get=false in the situation named.
Question 469
A Terraform deployment has independent requirements: (1) use the default provider configuration for a resource type; (2) avoid using provider versions from a newer unsupported major release. Which TWO mechanisms directly address these needs? Choose TWO.
- Provider integrity hashes
- An upper-bound provider constraint
- Implicit provider selection
- Provider-defined data sources
- Provider registry installation
Explanation
Correct Answers
B:A constraint such as < 6.0.0 prevents selection of versions that reach the excluded release boundary; this meets the requirement to avoid using provider versions from a newer unsupported major release, while the other selected techniques address use the default provider configuration for a resource type, which require their own distinct Terraform mechanisms.
C:Terraform generally selects the default provider matching a resource's type prefix unless an alternate configuration is specified; this meets the requirement to use the default provider configuration for a resource type, while the other selected techniques address avoid using provider versions from a newer unsupported major release, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:Terraform checks downloaded provider package checksums against lock information where hashes are available; it addresses detect a mismatched plugin distribution package, but this delivery instead requires use the default provider configuration for a resource type and avoid using provider versions from a newer unsupported major release. The required combination involves An upper-bound provider constraint and Implicit provider selection, not the behavior of Provider integrity hashes.
D:A provider's data source reads existing data and exposes attributes without creating or destroying the queried object; it addresses read information from an external service without owning its lifecycle, but this delivery instead requires use the default provider configuration for a resource type and avoid using provider versions from a newer unsupported major release. The required combination involves An upper-bound provider constraint and Implicit provider selection, not the behavior of Provider-defined data sources.
E:Terraform uses provider source metadata and its configured installation methods to find and install the appropriate plugin binary; it addresses retrieve a published plugin from its declared registry source, but this delivery instead requires use the default provider configuration for a resource type and avoid using provider versions from a newer unsupported major release. The required combination involves An upper-bound provider constraint and Implicit provider selection, not the behavior of Provider registry installation.
Question 470
During an infrastructure design review about how to send the correct region-specific provider into a reusable child module, a maintainer asks what “Module provider mappings” does. Which description is accurate?
- The providers map on the module call maps child provider names to selected provider configurations from the root module.
- All Terraform configuration files in a module directory are combined as one module; filenames do not define separate execution units.
- The count meta-argument creates numerically indexed module instances such as module.worker[0].
- Two module blocks that use the same source create separate module instances and separate resource addresses.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to send the correct region-specific provider into a reusable child module, so it produces the behavior described. In contrast, multiple calls to one module serves a different goal: deploy two independently managed stacks from the same module definition, not send the correct region-specific provider into a reusable child module.
Incorrect Answers
B:The description applies to a module root directory when an engineer needs to understand which source files Terraform loads as one module; the named module provider mappings instead handles the requirement to send the correct region-specific provider into a reusable child module, so this behavior does not describe Module provider mappings in the situation named.
C:The description applies to a module with count when an engineer needs to instantiate a fixed number of child module copies; the named module provider mappings instead handles the requirement to send the correct region-specific provider into a reusable child module, so this behavior does not describe Module provider mappings in the situation named.
D:The description applies to multiple calls to one module when an engineer needs to deploy two independently managed stacks from the same module definition; the named module provider mappings instead handles the requirement to send the correct region-specific provider into a reusable child module, so this behavior does not describe Module provider mappings in the situation named.