Question 260
A Terraform rollout has two separate requirements: first, avoid racing state mutations when several operators run Terraform; second, let a run wait briefly rather than fail immediately when state is busy. Which assignment of mechanisms correctly handles both responsibilities?
- First use Avoid disabling state locks; then use Lock identifier verification.
- First use Lock identifier verification; then use terraform -lock-timeout behavior.
- First use terraform -lock-timeout behavior; then use Lock acquisition before writes.
- First use Lock acquisition before writes; then use terraform -lock-timeout behavior.
- First use Lock acquisition before writes; then use Avoid disabling state locks.
Explanation
Correct Answer
D:The first requirement, to avoid racing state mutations when several operators run Terraform, is handled by Lock acquisition before writes: Terraform tries to obtain a state lock when the chosen backend supports it. The second requirement, to let a run wait briefly rather than fail immediately when state is busy, is handled by terraform -lock-timeout behavior: The lock-timeout flag controls how long supported operations retry obtaining a lock. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to avoid racing state mutations when several operators run Terraform and let a run wait briefly rather than fail immediately when state is busy, the first candidate Avoid disabling state locks addresses protect shared state rather than using -lock=false as a routine workaround; the second candidate Lock identifier verification addresses identify the precise stale lock before taking exceptional recovery action. This mapping fails because the first mechanism primarily supports the task to protect shared state rather than using -lock=false as a routine workaround and the second mechanism primarily supports the task to identify the precise stale lock before taking exceptional recovery action; the actual requirements are avoid racing state mutations when several operators run Terraform first and let a run wait briefly rather than fail immediately when state is busy second.
B:For the requested tasks to avoid racing state mutations when several operators run Terraform and let a run wait briefly rather than fail immediately when state is busy, the first candidate Lock identifier verification addresses identify the precise stale lock before taking exceptional recovery action; the second candidate terraform -lock-timeout behavior addresses let a run wait briefly rather than fail immediately when state is busy. This mapping fails because the first mechanism primarily supports the task to identify the precise stale lock before taking exceptional recovery action; the actual requirements are avoid racing state mutations when several operators run Terraform first and let a run wait briefly rather than fail immediately when state is busy second.
C:For the requested tasks to avoid racing state mutations when several operators run Terraform and let a run wait briefly rather than fail immediately when state is busy, the first candidate terraform -lock-timeout behavior addresses let a run wait briefly rather than fail immediately when state is busy; the second candidate Lock acquisition before writes addresses avoid racing state mutations when several operators run Terraform. This mapping fails because the first mechanism primarily supports the task to let a run wait briefly rather than fail immediately when state is busy and the second mechanism primarily supports the task to avoid racing state mutations when several operators run Terraform; the actual requirements are avoid racing state mutations when several operators run Terraform first and let a run wait briefly rather than fail immediately when state is busy second.
E:For the requested tasks to avoid racing state mutations when several operators run Terraform and let a run wait briefly rather than fail immediately when state is busy, the first candidate Lock acquisition before writes addresses avoid racing state mutations when several operators run Terraform; the second candidate Avoid disabling state locks addresses protect shared state rather than using -lock=false as a routine workaround. This mapping fails because the second mechanism primarily supports the task to protect shared state rather than using -lock=false as a routine workaround; the actual requirements are avoid racing state mutations when several operators run Terraform first and let a run wait briefly rather than fail immediately when state is busy second.
Question 261
A Terraform rollout has two separate requirements: first, preview the proposed actions before changing real resources; second, represent desired infrastructure in reviewable configuration files. Which assignment of mechanisms correctly handles both responsibilities?
- First use Infrastructure as code definition; then use Infrastructure execution plan.
- First use Terraform resource declaration; then use Infrastructure as code definition.
- First use Declarative infrastructure model; then use Terraform resource declaration.
- First use Infrastructure execution plan; then use Declarative infrastructure model.
- First use Infrastructure execution plan; then use Infrastructure as code definition.
Explanation
Correct Answer
E:The first requirement, to preview the proposed actions before changing real resources, is handled by Infrastructure execution plan: A Terraform plan calculates proposed actions from configuration, state, providers, and current observations. The second requirement, to represent desired infrastructure in reviewable configuration files, is handled by Infrastructure as code definition: Infrastructure as code describes infrastructure through machine-readable files instead of relying only on manual console operations. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to preview the proposed actions before changing real resources and represent desired infrastructure in reviewable configuration files, the first candidate Infrastructure as code definition addresses represent desired infrastructure in reviewable configuration files; the second candidate Infrastructure execution plan addresses preview the proposed actions before changing real resources. This mapping fails because the first mechanism primarily supports the task to represent desired infrastructure in reviewable configuration files and the second mechanism primarily supports the task to preview the proposed actions before changing real resources; the actual requirements are preview the proposed actions before changing real resources first and represent desired infrastructure in reviewable configuration files second.
B:For the requested tasks to preview the proposed actions before changing real resources and represent desired infrastructure in reviewable configuration files, the first candidate Terraform resource declaration addresses describe one managed infrastructure object in a configuration; the second candidate Infrastructure as code definition addresses represent desired infrastructure in reviewable configuration files. This mapping fails because the first mechanism primarily supports the task to describe one managed infrastructure object in a configuration; the actual requirements are preview the proposed actions before changing real resources first and represent desired infrastructure in reviewable configuration files second.
C:For the requested tasks to preview the proposed actions before changing real resources and represent desired infrastructure in reviewable configuration files, the first candidate Declarative infrastructure model addresses specify an end state rather than every API request; the second candidate Terraform resource declaration addresses describe one managed infrastructure object in a configuration. This mapping fails because the first mechanism primarily supports the task to specify an end state rather than every API request and the second mechanism primarily supports the task to describe one managed infrastructure object in a configuration; the actual requirements are preview the proposed actions before changing real resources first and represent desired infrastructure in reviewable configuration files second.
D:For the requested tasks to preview the proposed actions before changing real resources and represent desired infrastructure in reviewable configuration files, the first candidate Infrastructure execution plan addresses preview the proposed actions before changing real resources; the second candidate Declarative infrastructure model addresses specify an end state rather than every API request. This mapping fails because the second mechanism primarily supports the task to specify an end state rather than every API request; the actual requirements are preview the proposed actions before changing real resources first and represent desired infrastructure in reviewable configuration files second.
Question 262
A Terraform rollout has two separate requirements: first, expose specific child values to its parent with an output block; second, compute module-specific intermediate values without exporting them. Which assignment of mechanisms correctly handles both responsibilities?
- First use Module local values; then use Child module output scope.
- First use Child module output scope; then use Provider configuration scope.
- First use Provider configuration scope; then use Module input defaults.
- First use Module input defaults; then use Module local values.
- First use Child module output scope; then use Module local values.
Explanation
Correct Answer
E:The first requirement, to expose specific child values to its parent with an output block, is handled by Child module output scope: The parent can use module.child.output_name only when the child explicitly declares that output. The second requirement, to compute module-specific intermediate values without exporting them, is handled by Module local values: Local values belong to the defining module and are referenced through local.name in that scope. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to expose specific child values to its parent with an output block and compute module-specific intermediate values without exporting them, the first candidate Module local values addresses compute module-specific intermediate values without exporting them; the second candidate Child module output scope addresses expose specific child values to its parent with an output block. This mapping fails because the first mechanism primarily supports the task to compute module-specific intermediate values without exporting them and the second mechanism primarily supports the task to expose specific child values to its parent with an output block; the actual requirements are expose specific child values to its parent with an output block first and compute module-specific intermediate values without exporting them second.
B:For the requested tasks to expose specific child values to its parent with an output block and compute module-specific intermediate values without exporting them, the first candidate Child module output scope addresses expose specific child values to its parent with an output block; the second candidate Provider configuration scope addresses keep provider instances configured in the root and pass them to child modules. This mapping fails because the second mechanism primarily supports the task to keep provider instances configured in the root and pass them to child modules; the actual requirements are expose specific child values to its parent with an output block first and compute module-specific intermediate values without exporting them second.
C:For the requested tasks to expose specific child values to its parent with an output block and compute module-specific intermediate values without exporting them, the first candidate Provider configuration scope addresses keep provider instances configured in the root and pass them to child modules; the second candidate Module input defaults addresses make some child module arguments optional for callers. This mapping fails because the first mechanism primarily supports the task to keep provider instances configured in the root and pass them to child modules and the second mechanism primarily supports the task to make some child module arguments optional for callers; the actual requirements are expose specific child values to its parent with an output block first and compute module-specific intermediate values without exporting them second.
D:For the requested tasks to expose specific child values to its parent with an output block and compute module-specific intermediate values without exporting them, the first candidate Module input defaults addresses make some child module arguments optional for callers; the second candidate Module local values addresses compute module-specific intermediate values without exporting them. This mapping fails because the first mechanism primarily supports the task to make some child module arguments optional for callers; the actual requirements are expose specific child values to its parent with an output block first and compute module-specific intermediate values without exporting them second.
Question 263
The implementation must both enforce organizational rules during infrastructure runs and share reusable variables across selected workspaces. Which TWO mechanisms directly address these two separate requirements? Choose TWO.
- HCP Terraform teams and permissions
- HCP Terraform private module registry
- HCP Terraform variable sets
- HCP Terraform dynamic provider credentials
- HCP Terraform policy sets
Explanation
Correct Answers
C:Among the paired tasks to enforce organizational rules during infrastructure runs and share reusable variables across selected workspaces, HCP Terraform variable sets serves the requirement to share reusable variables across selected workspaces: Variable sets can provide common Terraform or environment variables to applicable workspaces. The other task must be covered by a separate mechanism.
E:Among the paired tasks to enforce organizational rules during infrastructure runs and share reusable variables across selected workspaces, HCP Terraform policy sets serves the requirement to enforce organizational rules during infrastructure runs: HCP Terraform can evaluate governance policies such as Sentinel or OPA as part of run controls. The other task must be covered by a separate mechanism.
Incorrect Answers
A:The requirements are enforce organizational rules during infrastructure runs and share reusable variables across selected workspaces, while HCP Terraform teams and permissions supports the different task to grant workspace access based on collaboration responsibilities: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying. That capability is outside the two selected responsibilities.
B:The requirements are enforce organizational rules during infrastructure runs and share reusable variables across selected workspaces, while HCP Terraform private module registry supports the different task to share approved reusable modules within an organization: A private registry distributes versioned modules to organization workspaces and teams. That capability is outside the two selected responsibilities.
D:The requested tasks are to enforce organizational rules during infrastructure runs; share reusable variables across selected workspaces, but HCP Terraform dynamic provider credentials primarily addresses the different goal to avoid long-lived static cloud credentials in workspace variables: Supported dynamic credentials issue time-limited tokens to runs based on trust configuration; therefore it is not one of the mechanisms selected for the stated requirements.
Question 264
A Terraform rollout has two separate requirements: first, use import planning support to help write resource HCL for an existing object; second, bring a pre-existing remote object under a resource address in Terraform state. Which assignment of mechanisms correctly handles both responsibilities?
- First use Generate import configuration where supported; then use terraform import CLI.
- First use Import resource address matching; then use terraform import CLI.
- First use Configuration-driven import block; then use Import resource address matching.
- First use terraform import CLI; then use Generate import configuration where supported.
- First use Generate import configuration where supported; then use Configuration-driven import block.
Explanation
Correct Answer
A:The first requirement, to use import planning support to help write resource HCL for an existing object, is handled by Generate import configuration where supported: Terraform supports generating configuration with appropriate import workflows for certain imported resources. The second requirement, to bring a pre-existing remote object under a resource address in Terraform state, is handled by terraform import CLI: terraform import ADDRESS ID binds the specified remote object to a declared resource instance. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
B:For the requested tasks to use import planning support to help write resource HCL for an existing object and bring a pre-existing remote object under a resource address in Terraform state, the first candidate Import resource address matching addresses map a discovered object to the intended Terraform resource instance address; the second candidate terraform import CLI addresses bring a pre-existing remote object under a resource address in Terraform state. This mapping fails because the first mechanism primarily supports the task to map a discovered object to the intended Terraform resource instance address; the actual requirements are use import planning support to help write resource HCL for an existing object first and bring a pre-existing remote object under a resource address in Terraform state second.
C:For the requested tasks to use import planning support to help write resource HCL for an existing object and bring a pre-existing remote object under a resource address in Terraform state, the first candidate Configuration-driven import block addresses declare an import target for normal planning and apply; the second candidate Import resource address matching addresses map a discovered object to the intended Terraform resource instance address. This mapping fails because the first mechanism primarily supports the task to declare an import target for normal planning and apply and the second mechanism primarily supports the task to map a discovered object to the intended Terraform resource instance address; the actual requirements are use import planning support to help write resource HCL for an existing object first and bring a pre-existing remote object under a resource address in Terraform state second.
D:For the requested tasks to use import planning support to help write resource HCL for an existing object and bring a pre-existing remote object under a resource address in Terraform state, the first candidate terraform import CLI addresses bring a pre-existing remote object under a resource address in Terraform state; the second candidate Generate import configuration where supported addresses use import planning support to help write resource HCL for an existing object. This mapping fails because the first mechanism primarily supports the task to bring a pre-existing remote object under a resource address in Terraform state and the second mechanism primarily supports the task to use import planning support to help write resource HCL for an existing object; the actual requirements are use import planning support to help write resource HCL for an existing object first and bring a pre-existing remote object under a resource address in Terraform state second.
E:For the requested tasks to use import planning support to help write resource HCL for an existing object and bring a pre-existing remote object under a resource address in Terraform state, the first candidate Generate import configuration where supported addresses use import planning support to help write resource HCL for an existing object; the second candidate Configuration-driven import block addresses declare an import target for normal planning and apply. This mapping fails because the second mechanism primarily supports the task to declare an import target for normal planning and apply; the actual requirements are use import planning support to help write resource HCL for an existing object first and bring a pre-existing remote object under a resource address in Terraform state second.
Question 265
A team is adjusting its declarative infrastructure process to refer to the current managed object in its own provisioner context. Which mechanism most directly meets this particular need?
- Self reference in provisioners
- Resource address for for_each instance
- Reference-based evaluation order
- Module output reference
Explanation
Correct Answer
A:The task is to refer to the current managed object in its own provisioner context; Self reference in provisioners directly supports that requirement: The self object is available in supported provisioner and connection contexts for the containing resource. Its relevant boundary is: It is not a general replacement for cross-resource references.
Incorrect Answers
B:Resource address for for_each instance is designed to refer to an instance selected by its map or set key, whereas this task is to refer to the current managed object in its own provisioner context: A for_each resource uses keyed addressing such as example["prod"] and exposes a key-specific object. Against Self reference in provisioners, its limitation is: A numeric count index is not interchangeable with a for_each string key.
C:Reference-based evaluation order is designed to avoid assuming files or block order determines operations, whereas this task is to refer to the current managed object in its own provisioner context: Terraform's graph follows expression dependencies, not the physical line order of configuration blocks. Against Self reference in provisioners, its limitation is: References can still form invalid cycles if dependencies point back to each other.
D:Module output reference is designed to use a value explicitly exported by a child module, whereas this task is to refer to the current managed object in its own provisioner context: The parent reads a child output through module.name.output_name rather than reaching into child internals. Against Self reference in provisioners, its limitation is: Unexported child resource attributes are not directly available to the caller.
Question 266
The deployment owner requests a reliable way to move existing state to a newly selected backend when changing its storage. Which mechanism most directly meets this particular need?
- Init without backend setup
- Init provider plugin upgrade control
- Initialization as safe repeated step
- Backend migration during init
Explanation
Correct Answer
D:The task is to move existing state to a newly selected backend when changing its storage; Backend migration during init directly supports that requirement: terraform init -migrate-state offers state migration when a backend configuration changes. Its relevant boundary is: Operators should safeguard and verify state before a migration.
Incorrect Answers
A:Init without backend setup is designed to work on configuration validation while deliberately skipping backend initialization, whereas this task is to move existing state to a newly selected backend when changing its storage: terraform init -backend=false skips the backend initialization step where appropriate. Against Backend migration during init, its limitation is: Commands needing live state might not work without a configured backend.
B:Init provider plugin upgrade control is designed to preserve locked provider selections in routine CI initialization, whereas this task is to move existing state to a newly selected backend when changing its storage: A normal terraform init honors the existing dependency lock selections unless update is requested. Against Backend migration during init, its limitation is: A changed constraint can require an explicit upgrade or other resolution.
C:Initialization as safe repeated step is designed to rerun initialization after adding a provider or changing module sources, whereas this task is to move existing state to a newly selected backend when changing its storage: It is normally safe to run terraform init repeatedly to satisfy updated dependencies. Against Backend migration during init, its limitation is: Reinitialization is not a substitute for planning after configuration changes.
Question 267
A deployment design calls for a supported way to allow only nonbreaking versions in a specified range. Which mechanism most directly meets this particular need?
- Terraform dependency lock file
- Provider version compatibility operator
- Provider version constraint
- required_providers source
Explanation
Correct Answer
B:The task is to allow only nonbreaking versions in a specified range; Provider version compatibility operator directly supports that requirement: A constraint like ~> 5.2 permits compatible versions within that bound while excluding the next incompatible major range. Its relevant boundary is: It is a permitted range, not proof of the installed provider's actual version.
Incorrect Answers
A:Terraform dependency lock file is designed to keep selected provider versions reproducible between runs, whereas this task is to allow only nonbreaking versions in a specified range: The .terraform.lock.hcl file records resolved provider versions and checksums for repeatable installation. Against Provider version compatibility operator, its limitation is: It does not lock child module versions or Terraform Core versions.
C:Provider version constraint is designed to restrict acceptable versions of an infrastructure provider, whereas this task is to allow only nonbreaking versions in a specified range: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. Against Provider version compatibility operator, its limitation is: The constraint is not the same as Terraform CLI required_version.
D:required_providers source is designed to identify the namespace and provider plugin that Terraform should install, whereas this task is to allow only nonbreaking versions in a specified range: The required_providers map supplies a provider source address such as hashicorp/aws for dependency resolution. Against Provider version compatibility operator, its limitation is: A provider block configures an installed provider instance rather than declaring its source.
Question 268
A platform engineering group needs to remove a stale lock only after confirming that no valid run owns it. Which mechanism most directly meets this particular need?
- terraform -lock-timeout behavior
- terraform force-unlock
- Lock acquisition before writes
- Avoid disabling state locks
Explanation
Correct Answer
B:The task is to remove a stale lock only after confirming that no valid run owns it; terraform force-unlock directly supports that requirement: force-unlock accepts a lock ID and bypasses normal waiting for an abandoned lock. Its relevant boundary is: Incorrectly breaking an active lock risks competing state modifications.
Incorrect Answers
A:terraform -lock-timeout behavior is designed to let a run wait briefly rather than fail immediately when state is busy, whereas this task is to remove a stale lock only after confirming that no valid run owns it: The lock-timeout flag controls how long supported operations retry obtaining a lock. Against terraform force-unlock, its limitation is: It does not itself activate locking on a backend that lacks that feature.
C:Lock acquisition before writes is designed to avoid racing state mutations when several operators run Terraform, whereas this task is to remove a stale lock only after confirming that no valid run owns it: Terraform tries to obtain a state lock when the chosen backend supports it. Against terraform force-unlock, its limitation is: A configuration-only validation step typically does not need to change state.
D:Avoid disabling state locks addresses the different requirement to protect shared state rather than using -lock=false as a routine workaround: Using a lock-capable backend with normal locking reduces state races; this does not by itself satisfy the requested task to remove a stale lock only after confirming that no valid run owns it. For the stated need, terraform force-unlock is the more direct mechanism.
Question 269
Before continuing an infrastructure rollout, the operator must distinguish CLI-supplied root inputs from child inputs. Which mechanism most directly meets this particular need?
- Root variable namespace
- Provider configuration scope
- Child module input variable
- Module local values
- Child module output scope
- Module input defaults
Explanation
Correct Answer
A:The task is to distinguish CLI-supplied root inputs from child inputs; Root variable namespace directly supports that requirement: CLI -var arguments set variables declared in the root module; child values pass through module call arguments. Its relevant boundary is: A variable with the same name in two modules is a separate declaration.
Incorrect Answers
B:Provider configuration scope is designed to keep provider instances configured in the root and pass them to child modules, whereas this task is to distinguish CLI-supplied root inputs from child inputs: A root module can explicitly map provider configurations into child module calls. Against Root variable namespace, its limitation is: An aliased provider is not automatically inherited as a child alias.
C:Child module input variable is designed to pass a caller-defined value into a reusable child module, whereas this task is to distinguish CLI-supplied root inputs from child inputs: The child declares a variable and the parent's module block assigns a value to that argument. Against Root variable namespace, its limitation is: An input declared in the child is not implicitly available as var.name in the parent.
D:Module local values is designed to compute module-specific intermediate values without exporting them, whereas this task is to distinguish CLI-supplied root inputs from child inputs: Local values belong to the defining module and are referenced through local.name in that scope. Against Root variable namespace, its limitation is: They are not automatically exposed through a module output reference.
E:Child module output scope is designed to expose specific child values to its parent with an output block, whereas this task is to distinguish CLI-supplied root inputs from child inputs: The parent can use module.child.output_name only when the child explicitly declares that output. Against Root variable namespace, its limitation is: Internal child locals and resource attributes remain encapsulated by default.
F:Module input defaults is designed to make some child module arguments optional for callers, whereas this task is to distinguish CLI-supplied root inputs from child inputs: A child variable with a default can be omitted by the caller, allowing the child to use its fallback. Against Root variable namespace, its limitation is: A default does not override an explicitly passed module argument.
Question 270
During a Terraform 1.12 implementation, the immediate requirement is to grant workspace access based on collaboration responsibilities. Which mechanism most directly meets this particular need?
- HCP Terraform dynamic provider credentials
- HCP Terraform teams and permissions
- HCP Terraform private module registry
- HCP Terraform auditability
- HCP Terraform drift detection
- HCP Terraform policy sets
Explanation
Correct Answer
B:The task is to grant workspace access based on collaboration responsibilities; HCP Terraform teams and permissions directly supports that requirement: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying. Its relevant boundary is: Team permission management requires a supported paid HCP Terraform edition; these roles do not replace cloud-provider permissions.
Incorrect Answers
A:HCP Terraform dynamic provider credentials is designed to avoid long-lived static cloud credentials in workspace variables, whereas this task is to grant workspace access based on collaboration responsibilities: Supported dynamic credentials issue time-limited tokens to runs based on trust configuration. Against HCP Terraform teams and permissions, its limitation is: The target provider and cloud identity federation must be configured correctly.
C:HCP Terraform private module registry is designed to share approved reusable modules within an organization, whereas this task is to grant workspace access based on collaboration responsibilities: A private registry distributes versioned modules to organization workspaces and teams. Against HCP Terraform teams and permissions, its limitation is: Publishing a module is different from executing a workspace run.
D:HCP Terraform auditability is designed to retain run and change history for collaboration and review, whereas this task is to grant workspace access based on collaboration responsibilities: Workspace run histories help teams trace proposed and executed infrastructure operations. Against HCP Terraform teams and permissions, its limitation is: A recorded run history is not the same as versioned source code approval.
E:HCP Terraform drift detection is designed to monitor for resources that have diverged from workspace configuration, whereas this task is to grant workspace access based on collaboration responsibilities: Health assessments can identify drift between tracked resources and desired configuration. Against HCP Terraform teams and permissions, its limitation is: HCP Terraform health assessments require Standard or Premium edition and an eligible workspace; detection itself does not automatically correct drift.
F:HCP Terraform policy sets is designed to enforce organizational rules during infrastructure runs, whereas this task is to grant workspace access based on collaboration responsibilities: HCP Terraform can evaluate governance policies such as Sentinel or OPA as part of run controls. Against HCP Terraform teams and permissions, its limitation is: Policies assess plans or configuration; they are not Terraform resource providers.