Question 280
A Terraform rollout has two separate requirements: first, refer to the current managed object in its own provisioner context; second, pass the generated ID of one resource into a dependent resource. Which assignment of mechanisms correctly handles both responsibilities?
- First use Self reference in provisioners; then use Implicit resource dependency.
- First use Resource address for count instance; then use Direct attribute reference.
- First use Implicit resource dependency; then use Resource address for count instance.
- First use Self reference in provisioners; then use Direct attribute reference.
- First use Direct attribute reference; then use Self reference in provisioners.
Explanation
Correct Answer
D:The first requirement, to refer to the current managed object in its own provisioner context, is handled by Self reference in provisioners: The self object is available in supported provisioner and connection contexts for the containing resource. The second requirement, to pass the generated ID of one resource into a dependent resource, is handled by Direct attribute reference: An expression such as aws_vpc.main.id links a consuming argument to an upstream resource attribute. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to refer to the current managed object in its own provisioner context and pass the generated ID of one resource into a dependent resource, the first candidate Self reference in provisioners addresses refer to the current managed object in its own provisioner context; the second candidate Implicit resource dependency addresses ensure a dependent resource waits for a referenced upstream attribute. This mapping fails because the second mechanism primarily supports the task to ensure a dependent resource waits for a referenced upstream attribute; the actual requirements are refer to the current managed object in its own provisioner context first and pass the generated ID of one resource into a dependent resource second.
B:For the requested tasks to refer to the current managed object in its own provisioner context and pass the generated ID of one resource into a dependent resource, the first candidate Resource address for count instance addresses select the exact indexed instance from count-created resources; the second candidate Direct attribute reference addresses pass the generated ID of one resource into a dependent resource. This mapping fails because the first mechanism primarily supports the task to select the exact indexed instance from count-created resources; the actual requirements are refer to the current managed object in its own provisioner context first and pass the generated ID of one resource into a dependent resource second.
C:For the requested tasks to refer to the current managed object in its own provisioner context and pass the generated ID of one resource into a dependent resource, the first candidate Implicit resource dependency addresses ensure a dependent resource waits for a referenced upstream attribute; the second candidate Resource address for count instance addresses select the exact indexed instance from count-created resources. This mapping fails because the first mechanism primarily supports the task to ensure a dependent resource waits for a referenced upstream attribute and the second mechanism primarily supports the task to select the exact indexed instance from count-created resources; the actual requirements are refer to the current managed object in its own provisioner context first and pass the generated ID of one resource into a dependent resource second.
E:For the requested tasks to refer to the current managed object in its own provisioner context and pass the generated ID of one resource into a dependent resource, the first candidate Direct attribute reference addresses pass the generated ID of one resource into a dependent resource; the second candidate Self reference in provisioners addresses refer to the current managed object in its own provisioner context. This mapping fails because the first mechanism primarily supports the task to pass the generated ID of one resource into a dependent resource and the second mechanism primarily supports the task to refer to the current managed object in its own provisioner context; the actual requirements are refer to the current managed object in its own provisioner context first and pass the generated ID of one resource into a dependent resource second.
Question 281
The rollout owner asks whether Backend migration during init is sufficient to move existing state to a newly selected backend when changing its storage. Which limitation specifically concerns that mechanism?
- Commands needing live state might not work without a configured backend.
- Operators should safeguard and verify state before a migration.
- Reinitialization is not a substitute for planning after configuration changes.
- A changed constraint can require an explicit upgrade or other resolution.
Explanation
Correct Answer
B:For Backend migration during init in the task to move existing state to a newly selected backend when changing its storage, the important caution is: Operators should safeguard and verify state before a migration. The reason this matters is its actual behavior: terraform init -migrate-state offers state migration when a backend configuration changes.
Incorrect Answers
A:The proposed warning belongs to Init without backend setup, which serves the different goal to work on configuration validation while deliberately skipping backend initialization, rather than to Backend migration during init: terraform init -backend=false skips the backend initialization step where appropriate. The question concerns Backend migration during init acting to move existing state to a newly selected backend when changing its storage, not a limit of Init without backend setup.
C:The proposed warning belongs to Initialization as safe repeated step, which serves the different goal to rerun initialization after adding a provider or changing module sources, rather than to Backend migration during init: It is normally safe to run terraform init repeatedly to satisfy updated dependencies. The question concerns Backend migration during init acting to move existing state to a newly selected backend when changing its storage, not a limit of Initialization as safe repeated step.
D:The proposed warning belongs to Init provider plugin upgrade control, which serves the different goal to preserve locked provider selections in routine CI initialization, rather than to Backend migration during init: A normal terraform init honors the existing dependency lock selections unless update is requested. The question concerns Backend migration during init acting to move existing state to a newly selected backend when changing its storage, not a limit of Init provider plugin upgrade control.
Question 282
The team is documenting risks of terraform force-unlock while planning to remove a stale lock only after confirming that no valid run owns it. Which caveat specifically applies to that mechanism?
- It does not itself activate locking on a backend that lacks that feature.
- -lock=false makes concurrent writers potentially unsafe.
- Incorrectly breaking an active lock risks competing state modifications.
- Not every backend supports locking in the same way.
- A configuration-only validation step typically does not need to change state.
Explanation
Correct Answer
C:For terraform force-unlock in the task to remove a stale lock only after confirming that no valid run owns it, the important caution is: Incorrectly breaking an active lock risks competing state modifications. The reason this matters is its actual behavior: force-unlock accepts a lock ID and bypasses normal waiting for an abandoned lock.
Incorrect Answers
A:The proposed warning belongs to terraform -lock-timeout behavior, which serves the different goal to let a run wait briefly rather than fail immediately when state is busy, rather than to terraform force-unlock: The lock-timeout flag controls how long supported operations retry obtaining a lock. The question concerns terraform force-unlock acting to remove a stale lock only after confirming that no valid run owns it, not a limit of terraform -lock-timeout behavior.
B:The proposed warning belongs to Avoid disabling state locks, which serves the different goal to protect shared state rather than using -lock=false as a routine workaround, rather than to terraform force-unlock: Using a lock-capable backend with normal locking reduces state races. The question concerns terraform force-unlock acting to remove a stale lock only after confirming that no valid run owns it, not a limit of Avoid disabling state locks.
D:The proposed warning belongs to Terraform state locking, which serves the different goal to prevent two concurrent runs from writing the same state snapshot, rather than to terraform force-unlock: A backend with locking support serializes operations that could corrupt shared state. The question concerns terraform force-unlock acting to remove a stale lock only after confirming that no valid run owns it, not a limit of Terraform state locking.
E:The proposed warning belongs to Lock acquisition before writes, which serves the different goal to avoid racing state mutations when several operators run Terraform, rather than to terraform force-unlock: Terraform tries to obtain a state lock when the chosen backend supports it. The question concerns terraform force-unlock acting to remove a stale lock only after confirming that no valid run owns it, not a limit of Lock acquisition before writes.
Question 283
A team reviews the use of Infrastructure provider API in Terraform 1.12. Which purpose matches its actual behavior?
- preview the proposed actions before changing real resources
- repeat an apply without recreating already matching resources
- translate declarative resources into operations on a platform
- record intended infrastructure settings under version control
Explanation
Correct Answer
C:The practical result of Infrastructure provider API, used to translate declarative resources into operations on a platform, is: Provider plugins supply resource implementations and call remote APIs when Terraform reconciles infrastructure. A qualification for this effect is: Terraform Core does not hard-code each cloud service API.
Incorrect Answers
A:That outcome applies to Infrastructure execution plan, intended to preview the proposed actions before changing real resources, rather than the question's feature Infrastructure provider API: A Terraform plan calculates proposed actions from configuration, state, providers, and current observations. Unlike Infrastructure execution plan, Infrastructure provider API is intended to translate declarative resources into operations on a platform, not to preview the proposed actions before changing real resources.
B:That outcome applies to Idempotent reconciliation, intended to repeat an apply without recreating already matching resources, rather than the question's feature Infrastructure provider API: Terraform compares desired configuration with prior state and refreshed remote information and normally plans no change when they agree. Unlike Idempotent reconciliation, Infrastructure provider API is intended to translate declarative resources into operations on a platform, not to repeat an apply without recreating already matching resources.
D:That outcome applies to Desired configuration, intended to record intended infrastructure settings under version control, rather than the question's feature Infrastructure provider API: Configuration expresses the operator's intended infrastructure and is the starting point for planning. Unlike Desired configuration, Infrastructure provider API is intended to translate declarative resources into operations on a platform, not to record intended infrastructure settings under version control.
Question 284
The rollout owner asks whether Root variable namespace is sufficient to distinguish CLI-supplied root inputs from child inputs. Which limitation specifically concerns that mechanism?
- An input declared in the child is not implicitly available as var.name in the parent.
- They are not automatically exposed through a module output reference.
- An aliased provider is not automatically inherited as a child alias.
- A variable with the same name in two modules is a separate declaration.
Explanation
Correct Answer
D:For Root variable namespace in the task to distinguish CLI-supplied root inputs from child inputs, the important caution is: A variable with the same name in two modules is a separate declaration. The reason this matters is its actual behavior: CLI -var arguments set variables declared in the root module; child values pass through module call arguments.
Incorrect Answers
A:The proposed warning belongs to Child module input variable, which serves the different goal to pass a caller-defined value into a reusable child module, rather than to Root variable namespace: The child declares a variable and the parent's module block assigns a value to that argument. The question concerns Root variable namespace acting to distinguish CLI-supplied root inputs from child inputs, not a limit of Child module input variable.
B:The proposed warning belongs to Module local values, which serves the different goal to compute module-specific intermediate values without exporting them, rather than to Root variable namespace: Local values belong to the defining module and are referenced through local.name in that scope. The question concerns Root variable namespace acting to distinguish CLI-supplied root inputs from child inputs, not a limit of Module local values.
C:The listed caution belongs specifically to Provider configuration scope, used to keep provider instances configured in the root and pass them to child modules: A root module can explicitly map provider configurations into child module calls; the feature under review is instead Root variable namespace, so this answer attaches another feature's qualification to the wrong mechanism.
Question 285
A change proposal relies on HCP Terraform teams and permissions for the task to grant workspace access based on collaboration responsibilities. Which limitation specifically applies to it?
- A recorded run history is not the same as versioned source code approval.
- The target provider and cloud identity federation must be configured correctly.
- HCP Terraform health assessments require Standard or Premium edition and an eligible workspace; detection itself does not automatically correct drift.
- Team permission management requires a supported paid HCP Terraform edition; these roles do not replace cloud-provider permissions.
Explanation
Correct Answer
D:For HCP Terraform teams and permissions in the task to grant workspace access based on collaboration responsibilities, the important caution is: Team permission management requires a supported paid HCP Terraform edition; these roles do not replace cloud-provider permissions. The reason this matters is its actual behavior: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying.
Incorrect Answers
A:The proposed warning belongs to HCP Terraform auditability, which serves the different goal to retain run and change history for collaboration and review, rather than to HCP Terraform teams and permissions: Workspace run histories help teams trace proposed and executed infrastructure operations. The question concerns HCP Terraform teams and permissions acting to grant workspace access based on collaboration responsibilities, not a limit of HCP Terraform auditability.
B:The proposed warning belongs to HCP Terraform dynamic provider credentials, which serves the different goal to avoid long-lived static cloud credentials in workspace variables, rather than to HCP Terraform teams and permissions: Supported dynamic credentials issue time-limited tokens to runs based on trust configuration. The question concerns HCP Terraform teams and permissions acting to grant workspace access based on collaboration responsibilities, not a limit of HCP Terraform dynamic provider credentials.
C:The proposed warning belongs to HCP Terraform drift detection, which serves the different goal to monitor for resources that have diverged from workspace configuration, rather than to HCP Terraform teams and permissions: Health assessments can identify drift between tracked resources and desired configuration. The question concerns HCP Terraform teams and permissions acting to grant workspace access based on collaboration responsibilities, not a limit of HCP Terraform drift detection.
Question 286
A team reviews the use of Import validation follow-up in Terraform 1.12. Which purpose matches its actual behavior?
- adopt an existing object rather than creating a new duplicate
- use import planning support to help write resource HCL for an existing object
- adopt a remote object from the correct account or region
- run a plan after importing an object to check unexpected updates
Explanation
Correct Answer
D:The practical result of Import validation follow-up, used to run a plan after importing an object to check unexpected updates, is: A post-import plan reveals whether declared settings match the newly adopted remote object. A qualification for this effect is: Import success alone does not prove the next apply is a no-op.
Incorrect Answers
A:That outcome applies to Import without recreation, intended to adopt an existing object rather than creating a new duplicate, rather than the question's feature Import validation follow-up: Import connects an existing provider object to the Terraform state mapping. Unlike Import without recreation, Import validation follow-up is intended to run a plan after importing an object to check unexpected updates, not to adopt an existing object rather than creating a new duplicate.
B:That outcome applies to Generate import configuration where supported, intended to use import planning support to help write resource HCL for an existing object, rather than the question's feature Import validation follow-up: Terraform supports generating configuration with appropriate import workflows for certain imported resources. Unlike Generate import configuration where supported, Import validation follow-up is intended to run a plan after importing an object to check unexpected updates, not to use import planning support to help write resource HCL for an existing object.
C:That outcome applies to Import under aliased provider, intended to adopt a remote object from the correct account or region, rather than the question's feature Import validation follow-up: The target resource's selected provider configuration determines how Terraform locates and reads the imported object. Unlike Import under aliased provider, Import validation follow-up is intended to run a plan after importing an object to check unexpected updates, not to adopt a remote object from the correct account or region.
Question 287
A deployment design calls for a supported way to avoid assuming files or block order determines operations. Which mechanism most directly meets this particular need?
- Implicit resource dependency
- Reference-based evaluation order
- Direct attribute reference
- Resource address for count instance
Explanation
Correct Answer
B:The task is to avoid assuming files or block order determines operations; Reference-based evaluation order directly supports that requirement: Terraform's graph follows expression dependencies, not the physical line order of configuration blocks. Its relevant boundary is: References can still form invalid cycles if dependencies point back to each other.
Incorrect Answers
A:Implicit resource dependency is designed to ensure a dependent resource waits for a referenced upstream attribute, whereas this task is to avoid assuming files or block order determines operations: Terraform infers dependencies when expressions reference other resources. Against Reference-based evaluation order, its limitation is: An explicit depends_on is unnecessary for relationships already expressed through references.
C:Direct attribute reference is designed to pass the generated ID of one resource into a dependent resource, whereas this task is to avoid assuming files or block order determines operations: An expression such as aws_vpc.main.id links a consuming argument to an upstream resource attribute. Against Reference-based evaluation order, its limitation is: Using a plain string ID loses that implicit graph dependency.
D:Resource address for count instance is designed to select the exact indexed instance from count-created resources, whereas this task is to avoid assuming files or block order determines operations: Count-created instances use numeric indices in expressions and state addresses, such as example[1]. Against Reference-based evaluation order, its limitation is: The index is not a stable semantic key if list ordering changes.
Question 288
A Terraform rollout has two separate requirements: first, move existing state to a newly selected backend when changing its storage; second, rerun initialization after adding a provider or changing module sources. Which assignment of mechanisms correctly handles both responsibilities?
- First use Initialization as safe repeated step; then use Backend migration during init.
- First use Backend migration during init; then use Initialization as safe repeated step.
- First use Backend migration during init; then use Init without backend setup.
- First use Init provider plugin upgrade control; then use Initialization as safe repeated step.
- First use Init without backend setup; then use Init provider plugin upgrade control.
Explanation
Correct Answer
B:The first requirement, to move existing state to a newly selected backend when changing its storage, is handled by Backend migration during init: terraform init -migrate-state offers state migration when a backend configuration changes. The second requirement, to rerun initialization after adding a provider or changing module sources, is handled by Initialization as safe repeated step: It is normally safe to run terraform init repeatedly to satisfy updated dependencies. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to move existing state to a newly selected backend when changing its storage and rerun initialization after adding a provider or changing module sources, the first candidate Initialization as safe repeated step addresses rerun initialization after adding a provider or changing module sources; the second candidate Backend migration during init addresses move existing state to a newly selected backend when changing its storage. This mapping fails because the first mechanism primarily supports the task to rerun initialization after adding a provider or changing module sources and the second mechanism primarily supports the task to move existing state to a newly selected backend when changing its storage; the actual requirements are move existing state to a newly selected backend when changing its storage first and rerun initialization after adding a provider or changing module sources second.
C:For the requested tasks to move existing state to a newly selected backend when changing its storage and rerun initialization after adding a provider or changing module sources, the first candidate Backend migration during init addresses move existing state to a newly selected backend when changing its storage; the second candidate Init without backend setup addresses work on configuration validation while deliberately skipping backend initialization. This mapping fails because the second mechanism primarily supports the task to work on configuration validation while deliberately skipping backend initialization; the actual requirements are move existing state to a newly selected backend when changing its storage first and rerun initialization after adding a provider or changing module sources second.
D:For the requested tasks to move existing state to a newly selected backend when changing its storage and rerun initialization after adding a provider or changing module sources, the first candidate Init provider plugin upgrade control addresses preserve locked provider selections in routine CI initialization; the second candidate Initialization as safe repeated step addresses rerun initialization after adding a provider or changing module sources. This mapping fails because the first mechanism primarily supports the task to preserve locked provider selections in routine CI initialization; the actual requirements are move existing state to a newly selected backend when changing its storage first and rerun initialization after adding a provider or changing module sources second.
E:For the requested tasks to move existing state to a newly selected backend when changing its storage and rerun initialization after adding a provider or changing module sources, the first candidate Init without backend setup addresses work on configuration validation while deliberately skipping backend initialization; the second candidate Init provider plugin upgrade control addresses preserve locked provider selections in routine CI initialization. This mapping fails because the first mechanism primarily supports the task to work on configuration validation while deliberately skipping backend initialization and the second mechanism primarily supports the task to preserve locked provider selections in routine CI initialization; the actual requirements are move existing state to a newly selected backend when changing its storage first and rerun initialization after adding a provider or changing module sources second.
Question 289
Before adopting Provider version compatibility operator to allow only nonbreaking versions in a specified range, which statement sets an accurate boundary?
- It does not lock child module versions or Terraform Core versions.
- A provider block configures an installed provider instance rather than declaring its source.
- It is a permitted range, not proof of the installed provider's actual version.
- The constraint is not the same as Terraform CLI required_version.
Explanation
Correct Answer
C:For Provider version compatibility operator in the task to allow only nonbreaking versions in a specified range, the important caution is: It is a permitted range, not proof of the installed provider's actual version. The reason this matters is its actual behavior: A constraint like ~> 5.2 permits compatible versions within that bound while excluding the next incompatible major range.
Incorrect Answers
A:The proposed warning belongs to Terraform dependency lock file, which serves the different goal to keep selected provider versions reproducible between runs, rather than to Provider version compatibility operator: The .terraform.lock.hcl file records resolved provider versions and checksums for repeatable installation. The question concerns Provider version compatibility operator acting to allow only nonbreaking versions in a specified range, not a limit of Terraform dependency lock file.
B:The proposed warning belongs to required_providers source, which serves the different goal to identify the namespace and provider plugin that Terraform should install, rather than to Provider version compatibility operator: The required_providers map supplies a provider source address such as hashicorp/aws for dependency resolution. The question concerns Provider version compatibility operator acting to allow only nonbreaking versions in a specified range, not a limit of required_providers source.
D:The proposed warning belongs to Provider version constraint, which serves the different goal to restrict acceptable versions of an infrastructure provider, rather than to Provider version compatibility operator: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. The question concerns Provider version compatibility operator acting to allow only nonbreaking versions in a specified range, not a limit of Provider version constraint.
Question 290
A Terraform rollout has two separate requirements: first, remove a stale lock only after confirming that no valid run owns it; second, protect shared state rather than using -lock=false as a routine workaround. Which assignment of mechanisms correctly handles both responsibilities?
- First use terraform force-unlock; then use Lock identifier verification.
- First use terraform force-unlock; then use Avoid disabling state locks.
- First use Lock identifier verification; then use Remote backend locking capabilities.
- First use Avoid disabling state locks; then use terraform force-unlock.
- First use Remote backend locking capabilities; then use Avoid disabling state locks.
Explanation
Correct Answer
B:The first requirement, to remove a stale lock only after confirming that no valid run owns it, is handled by terraform force-unlock: force-unlock accepts a lock ID and bypasses normal waiting for an abandoned lock. The second requirement, to protect shared state rather than using -lock=false as a routine workaround, is handled by Avoid disabling state locks: Using a lock-capable backend with normal locking reduces state races. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to remove a stale lock only after confirming that no valid run owns it and protect shared state rather than using -lock=false as a routine workaround, the first candidate terraform force-unlock addresses remove a stale lock only after confirming that no valid run owns it; the second candidate Lock identifier verification addresses identify the precise stale lock before taking exceptional recovery action. This mapping fails because the second mechanism primarily supports the task to identify the precise stale lock before taking exceptional recovery action; the actual requirements are remove a stale lock only after confirming that no valid run owns it first and protect shared state rather than using -lock=false as a routine workaround second.
C:For the requested tasks to remove a stale lock only after confirming that no valid run owns it and protect shared state rather than using -lock=false as a routine workaround, the first candidate Lock identifier verification addresses identify the precise stale lock before taking exceptional recovery action; the second candidate Remote backend locking capabilities addresses select shared state storage with appropriate concurrency semantics. This mapping fails because the first mechanism primarily supports the task to identify the precise stale lock before taking exceptional recovery action and the second mechanism primarily supports the task to select shared state storage with appropriate concurrency semantics; the actual requirements are remove a stale lock only after confirming that no valid run owns it first and protect shared state rather than using -lock=false as a routine workaround second.
D:For the requested tasks to remove a stale lock only after confirming that no valid run owns it and protect shared state rather than using -lock=false as a routine workaround, the first candidate Avoid disabling state locks addresses protect shared state rather than using -lock=false as a routine workaround; the second candidate terraform force-unlock addresses remove a stale lock only after confirming that no valid run owns it. 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 remove a stale lock only after confirming that no valid run owns it; the actual requirements are remove a stale lock only after confirming that no valid run owns it first and protect shared state rather than using -lock=false as a routine workaround second.
E:For the requested tasks to remove a stale lock only after confirming that no valid run owns it and protect shared state rather than using -lock=false as a routine workaround, the first candidate Remote backend locking capabilities addresses select shared state storage with appropriate concurrency semantics; 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 first mechanism primarily supports the task to select shared state storage with appropriate concurrency semantics; the actual requirements are remove a stale lock only after confirming that no valid run owns it first and protect shared state rather than using -lock=false as a routine workaround second.