Question 230
A technical review has three distinct objectives: prepare backend and plugin dependencies before planning; move existing state to a newly selected backend when changing its storage; and rerun initialization after adding a provider or changing module sources. Which THREE mechanisms should the team identify for these respective needs? Choose THREE.
- Module download on init
- Initialization as safe repeated step
- Initialize a new working directory
- Backend migration during init
- Backend reconfiguration during init
Explanation
Correct Answers
B:In the workflow combining prepare backend and plugin dependencies before planning, move existing state to a newly selected backend when changing its storage, and rerun initialization after adding a provider or changing module sources, Initialization as safe repeated step correctly addresses the individual goal to rerun initialization after adding a provider or changing module sources: It is normally safe to run terraform init repeatedly to satisfy updated dependencies. It is one of three separately required capabilities.
C:In the workflow combining prepare backend and plugin dependencies before planning, move existing state to a newly selected backend when changing its storage, and rerun initialization after adding a provider or changing module sources, Initialize a new working directory correctly addresses the individual goal to prepare backend and plugin dependencies before planning: terraform init configures backend access and fetches required modules and providers. It is one of three separately required capabilities.
D:In the workflow combining prepare backend and plugin dependencies before planning, move existing state to a newly selected backend when changing its storage, and rerun initialization after adding a provider or changing module sources, Backend migration during init correctly addresses the individual goal to move existing state to a newly selected backend when changing its storage: terraform init -migrate-state offers state migration when a backend configuration changes. It is one of three separately required capabilities.
Incorrect Answers
A:Compared with the three tasks to prepare backend and plugin dependencies before planning, move existing state to a newly selected backend when changing its storage, and rerun initialization after adding a provider or changing module sources, Module download on init primarily supports an unrelated request to install externally sourced child modules referenced by the root module: terraform init resolves module sources and downloads them to the local module cache. Therefore this option is not among the three specified mechanisms.
E:Compared with the three tasks to prepare backend and plugin dependencies before planning, move existing state to a newly selected backend when changing its storage, and rerun initialization after adding a provider or changing module sources, Backend reconfiguration during init primarily supports an unrelated request to accept an intentional backend configuration change without migrating state: terraform init -reconfigure disregards the existing backend initialization settings and uses new ones. Therefore this option is not among the three specified mechanisms.
Question 231
A technical review has three distinct objectives: prevent two concurrent runs from writing the same state snapshot; 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. Which THREE mechanisms should the team identify for these respective needs? Choose THREE.
- terraform -lock-timeout behavior
- Terraform state locking
- Avoid disabling state locks
- terraform force-unlock
- Lock acquisition before writes
Explanation
Correct Answers
B:In the workflow combining prevent two concurrent runs from writing the same state snapshot, 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, Terraform state locking correctly addresses the individual goal to prevent two concurrent runs from writing the same state snapshot: A backend with locking support serializes operations that could corrupt shared state. It is one of three separately required capabilities.
C:In the workflow combining prevent two concurrent runs from writing the same state snapshot, 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, Avoid disabling state locks correctly addresses the individual goal to protect shared state rather than using -lock=false as a routine workaround: Using a lock-capable backend with normal locking reduces state races. It is one of three separately required capabilities.
D:In the workflow combining prevent two concurrent runs from writing the same state snapshot, 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, terraform force-unlock correctly addresses the individual goal to remove a stale lock only after confirming that no valid run owns it: force-unlock accepts a lock ID and bypasses normal waiting for an abandoned lock. It is one of three separately required capabilities.
Incorrect Answers
A:Compared with the three tasks to prevent two concurrent runs from writing the same state snapshot, 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, terraform -lock-timeout behavior primarily supports an unrelated request to let a run wait briefly rather than fail immediately when state is busy: The lock-timeout flag controls how long supported operations retry obtaining a lock. Therefore this option is not among the three specified mechanisms.
E:Compared with the three tasks to prevent two concurrent runs from writing the same state snapshot, 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, Lock acquisition before writes primarily supports an unrelated request to avoid racing state mutations when several operators run Terraform: Terraform tries to obtain a state lock when the chosen backend supports it. Therefore this option is not among the three specified mechanisms.
Question 232
The rollout owner asks whether Resource address for for_each instance is sufficient to refer to an instance selected by its map or set key. Which limitation specifically concerns that mechanism?
- It is not a general replacement for cross-resource references.
- A numeric count index is not interchangeable with a for_each string key.
- References can still form invalid cycles if dependencies point back to each other.
- Unexported child resource attributes are not directly available to the caller.
Explanation
Correct Answer
B:For Resource address for for_each instance in the task to refer to an instance selected by its map or set key, the important caution is: A numeric count index is not interchangeable with a for_each string key. The reason this matters is its actual behavior: A for_each resource uses keyed addressing such as example["prod"] and exposes a key-specific object.
Incorrect Answers
A:The proposed warning belongs to Self reference in provisioners, which serves the different goal to refer to the current managed object in its own provisioner context, rather than to Resource address for for_each instance: The self object is available in supported provisioner and connection contexts for the containing resource. The question concerns Resource address for for_each instance acting to refer to an instance selected by its map or set key, not a limit of Self reference in provisioners.
C:The proposed warning belongs to Reference-based evaluation order, which serves the different goal to avoid assuming files or block order determines operations, rather than to Resource address for for_each instance: Terraform's graph follows expression dependencies, not the physical line order of configuration blocks. The question concerns Resource address for for_each instance acting to refer to an instance selected by its map or set key, not a limit of Reference-based evaluation order.
D:The proposed warning belongs to Module output reference, which serves the different goal to use a value explicitly exported by a child module, rather than to Resource address for for_each instance: The parent reads a child output through module.name.output_name rather than reaching into child internals. The question concerns Resource address for for_each instance acting to refer to an instance selected by its map or set key, not a limit of Module output reference.
Question 233
A Terraform rollout has two separate requirements: first, pass a caller-defined value into a reusable child module; second, distinguish CLI-supplied root inputs from child inputs. Which assignment of mechanisms correctly handles both responsibilities?
- First use Child module input variable; then use Root variable namespace.
- First use Module local values; then use Provider configuration scope.
- First use Root variable namespace; then use Child module input variable.
- First use Provider configuration scope; then use Root variable namespace.
- First use Child module input variable; then use Module local values.
Explanation
Correct Answer
A:The first requirement, to pass a caller-defined value into a reusable child module, is handled by Child module input variable: The child declares a variable and the parent's module block assigns a value to that argument. The second requirement, to distinguish CLI-supplied root inputs from child inputs, is handled by Root variable namespace: CLI -var arguments set variables declared in the root module; child values pass through module call arguments. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
B:For the requested tasks to pass a caller-defined value into a reusable child module and distinguish CLI-supplied root inputs from child inputs, the first candidate Module local values addresses compute module-specific intermediate values without exporting them; 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 first mechanism primarily supports the task to compute module-specific intermediate values without exporting them and 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 pass a caller-defined value into a reusable child module first and distinguish CLI-supplied root inputs from child inputs second.
C:For the requested tasks to pass a caller-defined value into a reusable child module and distinguish CLI-supplied root inputs from child inputs, the first candidate Root variable namespace addresses distinguish CLI-supplied root inputs from child inputs; the second candidate Child module input variable addresses pass a caller-defined value into a reusable child module. This mapping fails because the first mechanism primarily supports the task to distinguish CLI-supplied root inputs from child inputs and the second mechanism primarily supports the task to pass a caller-defined value into a reusable child module; the actual requirements are pass a caller-defined value into a reusable child module first and distinguish CLI-supplied root inputs from child inputs second.
D:For the requested tasks to pass a caller-defined value into a reusable child module and distinguish CLI-supplied root inputs from child inputs, the first candidate Provider configuration scope addresses keep provider instances configured in the root and pass them to child modules; the second candidate Root variable namespace addresses distinguish CLI-supplied root inputs from child inputs. 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; the actual requirements are pass a caller-defined value into a reusable child module first and distinguish CLI-supplied root inputs from child inputs second.
E:For the requested tasks to pass a caller-defined value into a reusable child module and distinguish CLI-supplied root inputs from child inputs, the first candidate Child module input variable addresses pass a caller-defined value into a reusable child module; the second candidate Module local values addresses compute module-specific intermediate values without exporting them. This mapping fails because the second mechanism primarily supports the task to compute module-specific intermediate values without exporting them; the actual requirements are pass a caller-defined value into a reusable child module first and distinguish CLI-supplied root inputs from child inputs second.
Question 234
A Terraform rollout has two separate requirements: first, share approved reusable modules within an organization; second, grant workspace access based on collaboration responsibilities. Which assignment of mechanisms correctly handles both responsibilities?
- First use HCP Terraform variable sets; then use HCP Terraform drift detection.
- First use HCP Terraform private module registry; then use HCP Terraform variable sets.
- First use HCP Terraform drift detection; then use HCP Terraform teams and permissions.
- First use HCP Terraform private module registry; then use HCP Terraform teams and permissions.
- First use HCP Terraform teams and permissions; then use HCP Terraform private module registry.
Explanation
Correct Answer
D:The first requirement, to share approved reusable modules within an organization, is handled by HCP Terraform private module registry: A private registry distributes versioned modules to organization workspaces and teams. The second requirement, to grant workspace access based on collaboration responsibilities, is handled by HCP Terraform teams and permissions: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to share approved reusable modules within an organization and grant workspace access based on collaboration responsibilities, the first candidate HCP Terraform variable sets addresses share reusable variables across selected workspaces; the second candidate HCP Terraform drift detection addresses monitor for resources that have diverged from workspace configuration. This mapping fails because the first mechanism primarily supports the task to share reusable variables across selected workspaces and the second mechanism primarily supports the task to monitor for resources that have diverged from workspace configuration; the actual requirements are share approved reusable modules within an organization first and grant workspace access based on collaboration responsibilities second.
B:For the requested tasks to share approved reusable modules within an organization and grant workspace access based on collaboration responsibilities, the first candidate HCP Terraform private module registry addresses share approved reusable modules within an organization; the second candidate HCP Terraform variable sets addresses share reusable variables across selected workspaces. This mapping fails because the second mechanism primarily supports the task to share reusable variables across selected workspaces; the actual requirements are share approved reusable modules within an organization first and grant workspace access based on collaboration responsibilities second.
C:For the requested tasks to share approved reusable modules within an organization and grant workspace access based on collaboration responsibilities, the first candidate HCP Terraform drift detection addresses monitor for resources that have diverged from workspace configuration; the second candidate HCP Terraform teams and permissions addresses grant workspace access based on collaboration responsibilities. This mapping fails because the first mechanism primarily supports the task to monitor for resources that have diverged from workspace configuration; the actual requirements are share approved reusable modules within an organization first and grant workspace access based on collaboration responsibilities second.
E:For the requested tasks to share approved reusable modules within an organization and grant workspace access based on collaboration responsibilities, the first candidate HCP Terraform teams and permissions addresses grant workspace access based on collaboration responsibilities; the second candidate HCP Terraform private module registry addresses share approved reusable modules within an organization. This mapping fails because the first mechanism primarily supports the task to grant workspace access based on collaboration responsibilities and the second mechanism primarily supports the task to share approved reusable modules within an organization; the actual requirements are share approved reusable modules within an organization first and grant workspace access based on collaboration responsibilities second.
Question 235
A Terraform runbook describes the mechanism "Provider installation during init". Which responsibility should a reviewer associate with it?
- allow only nonbreaking versions in a specified range
- restrict acceptable versions of an infrastructure provider
- populate or update provider checksum selections in the lock file
- download required plugins into the initialized working environment
- identify the namespace and provider plugin that Terraform should install
- ask initialization to reconsider allowed provider selections
Explanation
Correct Answer
D:The practical result of Provider installation during init, used to download required plugins into the initialized working environment, is: terraform init resolves provider dependencies and installs or reuses selected plugin packages. A qualification for this effect is: It does not apply infrastructure changes during initialization.
Incorrect Answers
A:That outcome applies to Provider version compatibility operator, intended to allow only nonbreaking versions in a specified range, rather than the question's feature Provider installation during init: A constraint like ~> 5.2 permits compatible versions within that bound while excluding the next incompatible major range. Unlike Provider version compatibility operator, Provider installation during init is intended to download required plugins into the initialized working environment, not to allow only nonbreaking versions in a specified range.
B:That outcome applies to Provider version constraint, intended to restrict acceptable versions of an infrastructure provider, rather than the question's feature Provider installation during init: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. Unlike Provider version constraint, Provider installation during init is intended to download required plugins into the initialized working environment, not to restrict acceptable versions of an infrastructure provider.
C:That outcome applies to terraform providers lock, intended to populate or update provider checksum selections in the lock file, rather than the question's feature Provider installation during init: The providers lock command can record provider package checksums for selected target platforms. Unlike terraform providers lock, Provider installation during init is intended to download required plugins into the initialized working environment, not to populate or update provider checksum selections in the lock file.
E:That outcome applies to required_providers source, intended to identify the namespace and provider plugin that Terraform should install, rather than the question's feature Provider installation during init: The required_providers map supplies a provider source address such as hashicorp/aws for dependency resolution. Unlike required_providers source, Provider installation during init is intended to download required plugins into the initialized working environment, not to identify the namespace and provider plugin that Terraform should install.
F:That outcome applies to terraform init -upgrade, intended to ask initialization to reconsider allowed provider selections, rather than the question's feature Provider installation during init: Using -upgrade during init allows newer versions satisfying the configured provider constraints to be selected. Unlike terraform init -upgrade, Provider installation during init is intended to download required plugins into the initialized working environment, not to ask initialization to reconsider allowed provider selections.
Question 236
A Terraform rollout has two separate requirements: first, refer to an instance selected by its map or set key; second, refer to the current managed object in its own provisioner context. Which assignment of mechanisms correctly handles both responsibilities?
- First use Resource address for for_each instance; then use Self reference in provisioners.
- First use Reference-based evaluation order; then use Direct attribute reference.
- First use Direct attribute reference; then use Self reference in provisioners.
- First use Self reference in provisioners; then use Resource address for for_each instance.
- First use Resource address for for_each instance; then use Reference-based evaluation order.
Explanation
Correct Answer
A:The first requirement, to refer to an instance selected by its map or set key, is handled by Resource address for for_each instance: A for_each resource uses keyed addressing such as example["prod"] and exposes a key-specific object. The second 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. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
B:For the requested tasks to refer to an instance selected by its map or set key and refer to the current managed object in its own provisioner context, the first candidate Reference-based evaluation order addresses avoid assuming files or block order determines operations; 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 avoid assuming files or block order determines operations and the second mechanism primarily supports the task to pass the generated ID of one resource into a dependent resource; the actual requirements are refer to an instance selected by its map or set key first and refer to the current managed object in its own provisioner context second.
C:For the requested tasks to refer to an instance selected by its map or set key and refer to the current managed object in its own provisioner context, 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; the actual requirements are refer to an instance selected by its map or set key first and refer to the current managed object in its own provisioner context second.
D:For the requested tasks to refer to an instance selected by its map or set key and refer to the current managed object in its own provisioner context, the first candidate Self reference in provisioners addresses refer to the current managed object in its own provisioner context; the second candidate Resource address for for_each instance addresses refer to an instance selected by its map or set key. This mapping fails because the first mechanism primarily supports the task to refer to the current managed object in its own provisioner context and the second mechanism primarily supports the task to refer to an instance selected by its map or set key; the actual requirements are refer to an instance selected by its map or set key first and refer to the current managed object in its own provisioner context second.
E:For the requested tasks to refer to an instance selected by its map or set key and refer to the current managed object in its own provisioner context, the first candidate Resource address for for_each instance addresses refer to an instance selected by its map or set key; the second candidate Reference-based evaluation order addresses avoid assuming files or block order determines operations. This mapping fails because the second mechanism primarily supports the task to avoid assuming files or block order determines operations; the actual requirements are refer to an instance selected by its map or set key first and refer to the current managed object in its own provisioner context second.
Question 237
A Terraform operator is specifically tasked to accept an intentional backend configuration change without migrating state. Which mechanism most directly meets this particular need?
- Module download on init
- Backend migration during init
- Initialize a new working directory
- Backend reconfiguration during init
Explanation
Correct Answer
D:The task is to accept an intentional backend configuration change without migrating state; Backend reconfiguration during init directly supports that requirement: terraform init -reconfigure disregards the existing backend initialization settings and uses new ones. Its relevant boundary is: It does not automatically move the old state into the new backend.
Incorrect Answers
A:Module download on init is designed to install externally sourced child modules referenced by the root module, whereas this task is to accept an intentional backend configuration change without migrating state: terraform init resolves module sources and downloads them to the local module cache. Against Backend reconfiguration during init, its limitation is: Downloading a module does not create its infrastructure.
B:Backend migration during init is designed to move existing state to a newly selected backend when changing its storage, whereas this task is to accept an intentional backend configuration change without migrating state: terraform init -migrate-state offers state migration when a backend configuration changes. Against Backend reconfiguration during init, its limitation is: Operators should safeguard and verify state before a migration.
C:Initialize a new working directory is designed to prepare backend and plugin dependencies before planning, whereas this task is to accept an intentional backend configuration change without migrating state: terraform init configures backend access and fetches required modules and providers. Against Backend reconfiguration during init, its limitation is: Initialization is not the command for creating managed resources.
Question 238
The deployment owner requests a reliable way to avoid racing state mutations when several operators run Terraform. Which mechanism most directly meets this particular need?
- Avoid disabling state locks
- Lock acquisition before writes
- Remote backend locking capabilities
- Lock identifier verification
Explanation
Correct Answer
B:The task is to avoid racing state mutations when several operators run Terraform; Lock acquisition before writes directly supports that requirement: Terraform tries to obtain a state lock when the chosen backend supports it. Its relevant boundary is: A configuration-only validation step typically does not need to change state.
Incorrect Answers
A:Avoid disabling state locks is designed to protect shared state rather than using -lock=false as a routine workaround, whereas this task is to avoid racing state mutations when several operators run Terraform: Using a lock-capable backend with normal locking reduces state races. Against Lock acquisition before writes, its limitation is: -lock=false makes concurrent writers potentially unsafe.
C:Remote backend locking capabilities is designed to select shared state storage with appropriate concurrency semantics, whereas this task is to avoid racing state mutations when several operators run Terraform: Supported remote backends can coordinate locking around updates to common state. Against Lock acquisition before writes, its limitation is: Remote storage and locking are related but distinct capabilities.
D:Lock identifier verification is designed to identify the precise stale lock before taking exceptional recovery action, whereas this task is to avoid racing state mutations when several operators run Terraform: A lock ID should be matched to the blocked state operation before unlocking. Against Lock acquisition before writes, its limitation is: Guessing an ID or acting during an active deployment can corrupt coordination.
Question 239
An operator chooses the mechanism "Infrastructure execution plan" for a Terraform project. Which outcome should this choice support?
- describe one managed infrastructure object in a configuration
- preview the proposed actions before changing real resources
- specify an end state rather than every API request
- represent desired infrastructure in reviewable configuration files
- repeat an apply without recreating already matching resources
- record intended infrastructure settings under version control
Explanation
Correct Answer
B:The practical result of Infrastructure execution plan, used to preview the proposed actions before changing real resources, is: A Terraform plan calculates proposed actions from configuration, state, providers, and current observations. A qualification for this effect is: Reviewing a plan is different from committing its effects to the remote system.
Incorrect Answers
A:That outcome applies to Terraform resource declaration, intended to describe one managed infrastructure object in a configuration, rather than the question's feature Infrastructure execution plan: A resource block represents an object that Terraform will create, update, or destroy through a provider. Unlike Terraform resource declaration, Infrastructure execution plan is intended to preview the proposed actions before changing real resources, not to describe one managed infrastructure object in a configuration.
C:That outcome applies to Declarative infrastructure model, intended to specify an end state rather than every API request, rather than the question's feature Infrastructure execution plan: A declarative model states the desired objects and lets Terraform determine an execution path from configuration and state. Unlike Declarative infrastructure model, Infrastructure execution plan is intended to preview the proposed actions before changing real resources, not to specify an end state rather than every API request.
D:That outcome applies to Infrastructure as code definition, intended to represent desired infrastructure in reviewable configuration files, rather than the question's feature Infrastructure execution plan: Infrastructure as code describes infrastructure through machine-readable files instead of relying only on manual console operations. Unlike Infrastructure as code definition, Infrastructure execution plan is intended to preview the proposed actions before changing real resources, not to represent desired infrastructure in reviewable configuration files.
E:That outcome applies to Idempotent reconciliation, intended to repeat an apply without recreating already matching resources, rather than the question's feature Infrastructure execution plan: Terraform compares desired configuration with prior state and refreshed remote information and normally plans no change when they agree. Unlike Idempotent reconciliation, Infrastructure execution plan is intended to preview the proposed actions before changing real resources, not to repeat an apply without recreating already matching resources.
F:That outcome applies to Desired configuration, intended to record intended infrastructure settings under version control, rather than the question's feature Infrastructure execution plan: Configuration expresses the operator's intended infrastructure and is the starting point for planning. Unlike Desired configuration, Infrastructure execution plan is intended to preview the proposed actions before changing real resources, not to record intended infrastructure settings under version control.
Question 240
A configuration review identifies the need to expose specific child values to its parent with an output block. Which mechanism most directly meets this particular need?
- Child module input variable
- Provider configuration scope
- Child module output scope
- Module outputs with repeated instances
- Module input defaults
Explanation
Correct Answer
C:The task is to expose specific child values to its parent with an output block; Child module output scope directly supports that requirement: The parent can use module.child.output_name only when the child explicitly declares that output. Its relevant boundary is: Internal child locals and resource attributes remain encapsulated by default.
Incorrect Answers
A:Child module input variable is designed to pass a caller-defined value into a reusable child module, whereas this task is to expose specific child values to its parent with an output block: The child declares a variable and the parent's module block assigns a value to that argument. Against Child module output scope, its limitation is: An input declared in the child is not implicitly available as var.name in the parent.
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 expose specific child values to its parent with an output block: A root module can explicitly map provider configurations into child module calls. Against Child module output scope, its limitation is: An aliased provider is not automatically inherited as a child alias.
D:Module outputs with repeated instances is designed to read values from every instance created by a counted or keyed module call, whereas this task is to expose specific child values to its parent with an output block: Counted module outputs use numeric indices; for_each module outputs use instance keys. Against Child module output scope, its limitation is: A repeated module call is not the same value shape as a single module output object.
E:Module input defaults is designed to make some child module arguments optional for callers, whereas this task is to expose specific child values to its parent with an output block: A child variable with a default can be omitted by the caller, allowing the child to use its fallback. Against Child module output scope, its limitation is: A default does not override an explicitly passed module argument.