Question 220
The team evaluates “Drift detection during planning” for a requirement to notice remote infrastructure changes made outside Terraform. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- Terraform can refresh managed objects during planning and flag differences between the observed infrastructure and configuration.
- With no configuration or remote drift requiring action, a new plan normally proposes no infrastructure changes.
- A policy or governance stage can inspect proposed infrastructure changes before allowing an apply to proceed.
- Terraform infers many dependencies from references and applies graph ordering to create or modify related resources safely.
- Version control and run history provide traceable context for what configuration changed and what Terraform planned or applied.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to notice remote infrastructure changes made outside Terraform, so it produces the behavior described. In contrast, policy checks before provisioning serves a different goal: enforce organizational infrastructure constraints consistently, not notice remote infrastructure changes made outside Terraform.
Incorrect Answers
B:The description applies to idempotent convergence when an engineer needs to run unchanged configuration repeatedly without inventing new infrastructure updates; the named drift detection during planning instead handles the requirement to notice remote infrastructure changes made outside Terraform, so this behavior does not describe Drift detection during planning in the situation named.
C:The description applies to policy checks before provisioning when an engineer needs to enforce organizational infrastructure constraints consistently; the named drift detection during planning instead handles the requirement to notice remote infrastructure changes made outside Terraform, so this behavior does not describe Drift detection during planning in the situation named.
D:The description applies to consistent dependency management when an engineer needs to avoid hand-sequencing every resource operation; the named drift detection during planning instead handles the requirement to notice remote infrastructure changes made outside Terraform, so this behavior does not describe Drift detection during planning in the situation named.
E:The description applies to reusable execution records when an engineer needs to audit the results of infrastructure changes across a team; the named drift detection during planning instead handles the requirement to notice remote infrastructure changes made outside Terraform, so this behavior does not describe Drift detection during planning in the situation named.
Question 221
During a design review, the requirement is to obtain module code from a repository that requires SSH-based access. Which option should the engineer select?
- Registry module documentation
- A private registry module source
- A Git SSH module source
- A public registry module source
Explanation
Correct Answer
C:A git::ssh:// module source delegates repository authentication to Git and SSH rather than a Terraform registry token; this directly meets the requirement to obtain module code from a repository that requires SSH-based access. By comparison, registry module documentation is intended to determine a module's declared inputs, outputs, providers and usage examples, which is a different task from obtain module code from a repository that requires SSH-based access.
Incorrect Answers
A:Published module documentation and metadata describe the module interface and help consumers understand required arguments; this mechanism is useful when the job is to determine a module's declared inputs, outputs, providers and usage examples, whereas the current scenario requires the engineer to obtain module code from a repository that requires SSH-based access. These operations have different effects in the stated Terraform workflow.
B:HCP Terraform's private registry can distribute approved modules with access control and supported version metadata; this mechanism is useful when the job is to reuse an internally published module available to authorized organization members, whereas the current scenario requires the engineer to obtain module code from a repository that requires SSH-based access. These operations have different effects in the stated Terraform workflow.
D:Registry module sources use the namespace/name/provider address form and can support a separate version argument; this mechanism is useful when the job is to download a community module published with an official registry address, whereas the current scenario requires the engineer to obtain module code from a repository that requires SSH-based access. These operations have different effects in the stated Terraform workflow.
Question 222
A team compares Terraform mechanisms for the goal to pass a temporary sensitive value from a child module to its parent. Which stated consequence belongs specifically to “An ephemeral child module output”?
- Saved plan files may contain sensitive values and must be handled as confidential artifacts rather than safe public summaries.
- Secrets inserted directly into tracked configuration can leak through repository history, regardless of later state redaction.
- Ephemeral outputs are permitted on child modules, allowing a value to travel through an allowed ephemeral context without entering state.
- Vault's dynamic credentials can provide expiring access with centrally enforced policies instead of permanent embedded keys.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to pass a temporary sensitive value from a child module to its parent, so it produces the behavior described. In contrast, vault short-lived credentials serves a different goal: limit the lifetime and scope of identities used by infrastructure automation, not pass a temporary sensitive value from a child module to its parent.
Incorrect Answers
A:The description applies to preventing credential leaks in plans when an engineer needs to avoid sharing a plan artifact publicly just because console values appear redacted; the named an ephemeral child module output instead handles the requirement to pass a temporary sensitive value from a child module to its parent, so this behavior does not describe An ephemeral child module output in the situation named.
B:The description applies to no secrets in version control when an engineer needs to keep API keys out of committed terraform.tfvars and .tf files; the named an ephemeral child module output instead handles the requirement to pass a temporary sensitive value from a child module to its parent, so this behavior does not describe An ephemeral child module output in the situation named.
D: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 an ephemeral child module output instead handles the requirement to pass a temporary sensitive value from a child module to its parent, so this behavior does not describe An ephemeral child module output in the situation named.
Question 223
A Terraform deployment has independent requirements: (1) store different applications' state snapshots at distinct object paths; (2) associate existing infrastructure with a newly declared Terraform resource address. Which TWO mechanisms directly address these needs? Choose TWO.
- A removed block with destroy=false
- An HCP Terraform cloud block
- Backend state key separation
- A state import workflow
- Backend credentials from the environment
Explanation
Correct Answers
C:Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot; this meets the requirement to store different applications' state snapshots at distinct object paths, while the other selected techniques address associate existing infrastructure with a newly declared Terraform resource address, which require their own distinct Terraform mechanisms.
D:Importing attaches the remote object's identity to state; compatible configuration is still needed to avoid unwanted changes afterward; this meets the requirement to associate existing infrastructure with a newly declared Terraform resource address, while the other selected techniques address store different applications' state snapshots at distinct object paths, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:A removed block can intentionally forget the previous resource address without a provider delete when lifecycle destroy is false; it addresses declare that a resource should leave management while its actual object is retained, but this delivery instead requires store different applications' state snapshots at distinct object paths and associate existing infrastructure with a newly declared Terraform resource address. The required combination involves Backend state key separation and A state import workflow, not the behavior of A removed block with destroy=false.
B:The terraform cloud block connects configuration to HCP Terraform, and cannot coexist with a standard backend block in the same configuration; it addresses integrate Terraform CLI with an HCP organization and workspace, but this delivery instead requires store different applications' state snapshots at distinct object paths and associate existing infrastructure with a newly declared Terraform resource address. The required combination involves Backend state key separation and A state import workflow, not the behavior of An HCP Terraform cloud block.
E:Supported backends can discover authentication from environment settings or identity mechanisms rather than inline key literals; it addresses avoid embedding cloud backend access keys into tracked Terraform source, but this delivery instead requires store different applications' state snapshots at distinct object paths and associate existing infrastructure with a newly declared Terraform resource address. The required combination involves Backend state key separation and A state import workflow, not the behavior of Backend credentials from the environment.
Question 224
A declarative resource and expression design has a concrete implementation goal: plan to delete a previously managed object that remains in state. What is the most appropriate Terraform mechanism?
- The terraform_data resource
- Removing a resource declaration
- A data source block
- Resource local names
Explanation
Correct Answer
B:When a managed resource is absent from configuration but still tracked in state, normal planning proposes its destruction; this directly meets the requirement to plan to delete a previously managed object that remains in state. By comparison, resource local names is intended to distinguish two managed instances of the same provider-defined resource type, which is a different task from plan to delete a previously managed object that remains in state.
Incorrect Answers
A:The built-in terraform_data resource can represent input changes and trigger replacement behavior without managing a cloud API resource; this mechanism is useful when the job is to model a Terraform-managed lifecycle value without requiring an external service object, whereas the current scenario requires the engineer to plan to delete a previously managed object that remains in state. These operations have different effects in the stated Terraform workflow.
C:A data block asks a provider to read information and does not make Terraform create or destroy the referenced remote object; this mechanism is useful when the job is to look up an already existing object without taking ownership of its lifecycle, whereas the current scenario requires the engineer to plan to delete a previously managed object that remains in state. These operations have different effects in the stated Terraform workflow.
D:A resource block has a type and a local label; together they form its address within the module; this mechanism is useful when the job is to distinguish two managed instances of the same provider-defined resource type, whereas the current scenario requires the engineer to plan to delete a previously managed object that remains in state. These operations have different effects in the stated Terraform workflow.
Question 225
An application stack composed of modules requires a way to retrieve child modules without running the complete backend and provider setup steps. Which Terraform approach most directly fulfills that request?
- A public registry module source
- A separate module repository
- terraform get
- Registry module documentation
- A Git SSH module source
Explanation
Correct Answer
C:The terraform get command updates downloaded module sources only; routine workflows generally prefer terraform init; this directly meets the requirement to retrieve child modules without running the complete backend and provider setup steps. By comparison, a Git SSH module source is intended to obtain module code from a repository that requires SSH-based access, which is a different task from retrieve child modules without running the complete backend and provider setup steps.
Incorrect Answers
A:Registry module sources use the namespace/name/provider address form and can support a separate version argument; this mechanism is useful when the job is to download a community module published with an official registry address, whereas the current scenario requires the engineer to retrieve child modules without running the complete backend and provider setup steps. These operations have different effects in the stated Terraform workflow.
B:Keeping reusable child modules separately versioned allows independent adoption and maintenance by different Terraform root modules; this mechanism is useful when the job is to share reusable Terraform configuration with multiple root projects, whereas the current scenario requires the engineer to retrieve child modules without running the complete backend and provider setup steps. These operations have different effects in the stated Terraform workflow.
D:Published module documentation and metadata describe the module interface and help consumers understand required arguments; this mechanism is useful when the job is to determine a module's declared inputs, outputs, providers and usage examples, whereas the current scenario requires the engineer to retrieve child modules without running the complete backend and provider setup steps. These operations have different effects in the stated Terraform workflow.
E:A git::ssh:// module source delegates repository authentication to Git and SSH rather than a Terraform registry token; this mechanism is useful when the job is to obtain module code from a repository that requires SSH-based access, whereas the current scenario requires the engineer to retrieve child modules without running the complete backend and provider setup steps. These operations have different effects in the stated Terraform workflow.
Question 226
During an infrastructure design review about how to export a state snapshot from the configured backend for careful examination, a maintainer asks what “terraform state pull” does. Which description is accurate?
- The providers command displays provider requirements and their module relationships for dependency troubleshooting.
- The JSON representation supports automated inspection but must be protected because redacted display is not a security boundary.
- Replace-provider rewrites provider source references in state and creates a backup before the edit.
- State pull reads the current snapshot to standard output, including potentially sensitive provider attributes.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to export a state snapshot from the configured backend for careful examination, so it produces the behavior described. In contrast, terraform state replace-provider serves a different goal: update the provider source address recorded for affected state resources, not export a state snapshot from the configured backend for careful examination.
Incorrect Answers
A:The description applies to terraform providers when an engineer needs to inspect which providers the current configuration requires; the named terraform state pull instead handles the requirement to export a state snapshot from the configured backend for careful examination, so this behavior does not describe terraform state pull in the situation named.
B:The description applies to terraform show -json when an engineer needs to read plan or state information in a structured representation; the named terraform state pull instead handles the requirement to export a state snapshot from the configured backend for careful examination, so this behavior does not describe terraform state pull in the situation named.
C:The description applies to terraform state replace-provider when an engineer needs to update the provider source address recorded for affected state resources; the named terraform state pull instead handles the requirement to export a state snapshot from the configured backend for careful examination, so this behavior does not describe terraform state pull in the situation named.
Question 227
An operations team replacing ad-hoc scripts has a concrete implementation goal: enforce organizational infrastructure constraints consistently. What is the most appropriate Terraform mechanism?
- Consistent dependency management
- Collaboration through remote state
- Reusing modules
- Policy checks before provisioning
- Environment parametrization
Explanation
Correct Answer
D:A policy or governance stage can inspect proposed infrastructure changes before allowing an apply to proceed; this directly meets the requirement to enforce organizational infrastructure constraints consistently. By comparison, environment parametrization is intended to deploy similarly structured stacks with environment-specific settings, which is a different task from enforce organizational infrastructure constraints consistently.
Incorrect Answers
A:Terraform infers many dependencies from references and applies graph ordering to create or modify related resources safely; this mechanism is useful when the job is to avoid hand-sequencing every resource operation, whereas the current scenario requires the engineer to enforce organizational infrastructure constraints consistently. These operations have different effects in the stated Terraform workflow.
B:A backend supporting remote storage and locking can centralize state and prevent conflicting concurrent changes; this mechanism is useful when the job is to allow authorized operators to use one shared source of Terraform state, whereas the current scenario requires the engineer to enforce organizational infrastructure constraints consistently. These operations have different effects in the stated Terraform workflow.
C:A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design; this mechanism is useful when the job is to standardize a reusable network pattern across multiple applications, whereas the current scenario requires the engineer to enforce organizational infrastructure constraints consistently. These operations have different effects in the stated Terraform workflow.
E:Terraform input variables permit different values for capacity, names and endpoints without copying the entire resource definition; this mechanism is useful when the job is to deploy similarly structured stacks with environment-specific settings, whereas the current scenario requires the engineer to enforce organizational infrastructure constraints consistently. These operations have different effects in the stated Terraform workflow.
Question 228
Reviewers reject “Provider configuration at the root” as a way to read an object from a secondary account rather than the default account. Which actual behavior explains why the proposal is unsuitable?
- An unaliased provider block configures the default instance used by matching resources that do not override provider selection.
- Reusable child modules should primarily declare provider requirements and receive configurations from callers rather than embedding fixed credentials.
- Declare an aliased provider configuration and assign provider = provider_name.alias on resources that need the alternate region.
- A data block can set provider = aws.secondary to query through an alternate provider configuration.
Explanation
Correct Answer
B:Provider configuration at the root is used when an operator needs to supply provider configurations from the root module to reusable child modules. Consequently, this choice cannot meet the separate requirement to read an object from a secondary account rather than the default account. The intended action would instead require Explicit provider selection on data blocks.
Incorrect Answers
A:This behavior belongs to A default provider configuration, which helps engineers make resources use a common account without an explicit provider argument rather than satisfying the separate requirement to read an object from a secondary account rather than the default account. The attempted technique was Provider configuration at the root; it would instead be used to supply provider configurations from the root module to reusable child modules, not to produce the effect associated with A default provider configuration.
C:This behavior belongs to An aliased provider instance, which helps engineers create resources in a second region using the same provider type rather than satisfying the separate requirement to read an object from a secondary account rather than the default account. The attempted technique was Provider configuration at the root; it would instead be used to supply provider configurations from the root module to reusable child modules, not to produce the effect associated with An aliased provider instance.
D:That outcome belongs to Explicit provider selection on data blocks, the mechanism that can read an object from a secondary account rather than the default account. The question concerns the engineer’s actual proposal, Provider configuration at the root; it is directed at supply provider configurations from the root module to reusable child modules, not that result.
Question 229
A team compares Terraform mechanisms for the goal to protect stored state contents from unauthorized storage-layer access. Which stated consequence belongs specifically to “Remote state encryption at rest”?
- Backend configuration is processed at initialization, before ordinary input expressions are evaluated, so it cannot use regular variables or locals.
- Supported backends can discover authentication from environment settings or identity mechanisms rather than inline key literals.
- A terraform { backend "TYPE" {} } declaration selects state storage; its settings are initialized separately from provider configuration.
- Encryption is controlled by the chosen backend service; Terraform's remote backend abstraction does not supply one universal encryption mechanism.
- The terraform cloud block connects configuration to HCP Terraform, and cannot coexist with a standard backend block in the same configuration.
- The reconfigure flag discards cached previous backend settings and does not copy the prior state snapshot.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to protect stored state contents from unauthorized storage-layer access, so it produces the behavior described. In contrast, an HCP Terraform cloud block serves a different goal: integrate Terraform CLI with an HCP organization and workspace, not protect stored state contents from unauthorized storage-layer access.
Incorrect Answers
A:The description applies to no input variable interpolation in a backend block when an engineer needs to avoid expecting var.region or local.name to populate backend settings; the named remote state encryption at rest instead handles the requirement to protect stored state contents from unauthorized storage-layer access, so this behavior does not describe Remote state encryption at rest in the situation named.
B:The description applies to backend credentials from the environment when an engineer needs to avoid embedding cloud backend access keys into tracked Terraform source; the named remote state encryption at rest instead handles the requirement to protect stored state contents from unauthorized storage-layer access, so this behavior does not describe Remote state encryption at rest in the situation named.
C:The description applies to a terraform backend block when an engineer needs to declare the backend type and settings used to store root-module state; the named remote state encryption at rest instead handles the requirement to protect stored state contents from unauthorized storage-layer access, so this behavior does not describe Remote state encryption at rest in the situation named.
E:The description applies to an HCP Terraform cloud block when an engineer needs to integrate Terraform CLI with an HCP organization and workspace; the named remote state encryption at rest instead handles the requirement to protect stored state contents from unauthorized storage-layer access, so this behavior does not describe Remote state encryption at rest in the situation named.
F:The description applies to terraform init -reconfigure when an engineer needs to switch backend settings without performing automatic state migration; the named remote state encryption at rest instead handles the requirement to protect stored state contents from unauthorized storage-layer access, so this behavior does not describe Remote state encryption at rest in the situation named.
Question 230
A runbook lists “Drift detection boundaries” for the task to understand that Terraform only examines infrastructure represented in its configuration or state scope. Which technical effect should its description include?
- The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed.
- A plan does not discover every unmanaged object in an account; its normal focus is tracked resources and configured data sources.
- Refresh-only apply can update the recorded state to match observed remote attributes without modifying cloud resources.
- State metadata such as lineage and serial helps protect against incompatible or stale state updates.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to understand that Terraform only examines infrastructure represented in its configuration or state scope, 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 understand that Terraform only examines infrastructure represented in its configuration or state scope.
Incorrect Answers
A:The description applies to ignore_changes for shared ownership when an engineer needs to stop Terraform from overwriting a field delegated to an external controller; the named drift detection boundaries instead handles the requirement to understand that Terraform only examines infrastructure represented in its configuration or state scope, so this behavior does not describe Drift detection boundaries in the situation named.
C:The description applies to terraform apply -refresh-only when an engineer needs to accept current remote readings into Terraform's state through an apply operation; the named drift detection boundaries instead handles the requirement to understand that Terraform only examines infrastructure represented in its configuration or state scope, so this behavior does not describe Drift detection boundaries in the situation named.
D: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 drift detection boundaries instead handles the requirement to understand that Terraform only examines infrastructure represented in its configuration or state scope, so this behavior does not describe Drift detection boundaries in the situation named.