Question 300
A reviewer is asked to choose a mechanism to share reusable variables across selected workspaces. Which mechanism most directly meets this particular need?
- HCP Terraform private module registry
- HCP Terraform teams and permissions
- HCP Terraform variable sets
- HCP Terraform policy sets
Explanation
Correct Answer
C:The task is to share reusable variables across selected workspaces; HCP Terraform variable sets directly supports that requirement: Variable sets can provide common Terraform or environment variables to applicable workspaces. Its relevant boundary is: Per-workspace values and precedence must be reviewed when there are overlaps.
Incorrect Answers
A:HCP Terraform private module registry is designed to share approved reusable modules within an organization, whereas this task is to share reusable variables across selected workspaces: A private registry distributes versioned modules to organization workspaces and teams. Against HCP Terraform variable sets, its limitation is: Publishing a module is different from executing a workspace run.
B:HCP Terraform teams and permissions is designed to grant workspace access based on collaboration responsibilities, whereas this task is to share reusable variables across selected workspaces: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying. Against HCP Terraform variable sets, its limitation is: Team permission management requires a supported paid HCP Terraform edition; these roles do not replace cloud-provider permissions.
D:HCP Terraform policy sets is designed to enforce organizational rules during infrastructure runs, whereas this task is to share reusable variables across selected workspaces: HCP Terraform can evaluate governance policies such as Sentinel or OPA as part of run controls. Against HCP Terraform variable sets, its limitation is: Policies assess plans or configuration; they are not Terraform resource providers.
Question 301
A Terraform rollout has two separate requirements: first, allow only nonbreaking versions in a specified range; second, restrict acceptable versions of an infrastructure provider. Which assignment of mechanisms correctly handles both responsibilities?
- First use Terraform dependency lock file; then use terraform init -upgrade.
- First use Provider version compatibility operator; then use Terraform dependency lock file.
- First use Provider version constraint; then use Provider version compatibility operator.
- First use terraform init -upgrade; then use Provider version constraint.
- First use Provider version compatibility operator; then use Provider version constraint.
Explanation
Correct Answer
E:The first requirement, to allow only nonbreaking versions in a specified range, is handled by Provider version compatibility operator: A constraint like ~> 5.2 permits compatible versions within that bound while excluding the next incompatible major range. The second requirement, to restrict acceptable versions of an infrastructure provider, is handled by Provider version constraint: The version argument in required_providers expresses allowed provider versions, such as a compatible release series. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to allow only nonbreaking versions in a specified range and restrict acceptable versions of an infrastructure provider, the first candidate Terraform dependency lock file addresses keep selected provider versions reproducible between runs; the second candidate terraform init -upgrade addresses ask initialization to reconsider allowed provider selections. This mapping fails because the first mechanism primarily supports the task to keep selected provider versions reproducible between runs and the second mechanism primarily supports the task to ask initialization to reconsider allowed provider selections; the actual requirements are allow only nonbreaking versions in a specified range first and restrict acceptable versions of an infrastructure provider second.
B:For the requested tasks to allow only nonbreaking versions in a specified range and restrict acceptable versions of an infrastructure provider, the first candidate Provider version compatibility operator addresses allow only nonbreaking versions in a specified range; the second candidate Terraform dependency lock file addresses keep selected provider versions reproducible between runs. This mapping fails because the second mechanism primarily supports the task to keep selected provider versions reproducible between runs; the actual requirements are allow only nonbreaking versions in a specified range first and restrict acceptable versions of an infrastructure provider second.
C:For the requested tasks to allow only nonbreaking versions in a specified range and restrict acceptable versions of an infrastructure provider, the first candidate Provider version constraint addresses restrict acceptable versions of an infrastructure provider; the second candidate Provider version compatibility operator addresses allow only nonbreaking versions in a specified range. This mapping fails because the first mechanism primarily supports the task to restrict acceptable versions of an infrastructure provider and the second mechanism primarily supports the task to allow only nonbreaking versions in a specified range; the actual requirements are allow only nonbreaking versions in a specified range first and restrict acceptable versions of an infrastructure provider second.
D:For the requested tasks to allow only nonbreaking versions in a specified range and restrict acceptable versions of an infrastructure provider, the first candidate terraform init -upgrade addresses ask initialization to reconsider allowed provider selections; the second candidate Provider version constraint addresses restrict acceptable versions of an infrastructure provider. This mapping fails because the first mechanism primarily supports the task to ask initialization to reconsider allowed provider selections; the actual requirements are allow only nonbreaking versions in a specified range first and restrict acceptable versions of an infrastructure provider second.
Question 302
A Terraform rollout has two separate requirements: first, avoid assuming files or block order determines operations; second, ensure a dependent resource waits for a referenced upstream attribute. Which assignment of mechanisms correctly handles both responsibilities?
- First use Resource address for count instance; then use Resource address for for_each instance.
- First use Reference-based evaluation order; then use Resource address for count instance.
- First use Resource address for for_each instance; then use Implicit resource dependency.
- First use Reference-based evaluation order; then use Implicit resource dependency.
- First use Implicit resource dependency; then use Reference-based evaluation order.
Explanation
Correct Answer
D:The first requirement, to avoid assuming files or block order determines operations, is handled by Reference-based evaluation order: Terraform's graph follows expression dependencies, not the physical line order of configuration blocks. The second requirement, to ensure a dependent resource waits for a referenced upstream attribute, is handled by Implicit resource dependency: Terraform infers dependencies when expressions reference other resources. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to avoid assuming files or block order determines operations and ensure a dependent resource waits for a referenced upstream attribute, the first candidate Resource address for count instance addresses select the exact indexed instance from count-created resources; 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 select the exact indexed instance from count-created resources and the second mechanism primarily supports the task to refer to an instance selected by its map or set key; the actual requirements are avoid assuming files or block order determines operations first and ensure a dependent resource waits for a referenced upstream attribute second.
B:For the requested tasks to avoid assuming files or block order determines operations and ensure a dependent resource waits for a referenced upstream attribute, the first candidate Reference-based evaluation order addresses avoid assuming files or block order determines operations; the second candidate Resource address for count instance addresses select the exact indexed instance from count-created resources. This mapping fails because the second mechanism primarily supports the task to select the exact indexed instance from count-created resources; the actual requirements are avoid assuming files or block order determines operations first and ensure a dependent resource waits for a referenced upstream attribute second.
C:For the requested tasks to avoid assuming files or block order determines operations and ensure a dependent resource waits for a referenced upstream attribute, the first candidate Resource address for for_each instance addresses refer to an instance selected by its map or set key; the second candidate Implicit resource dependency addresses ensure a dependent resource waits for a referenced upstream attribute. This mapping fails because the first mechanism primarily supports the task to refer to an instance selected by its map or set key; the actual requirements are avoid assuming files or block order determines operations first and ensure a dependent resource waits for a referenced upstream attribute second.
E:For the requested tasks to avoid assuming files or block order determines operations and ensure a dependent resource waits for a referenced upstream attribute, the first candidate Implicit resource dependency addresses ensure a dependent resource waits for a referenced upstream attribute; the second candidate Reference-based evaluation order addresses avoid assuming files or block order determines operations. 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 avoid assuming files or block order determines operations; the actual requirements are avoid assuming files or block order determines operations first and ensure a dependent resource waits for a referenced upstream attribute second.
Question 303
An operator chooses the mechanism "Module download on init" for a Terraform project. Which outcome should this choice support?
- move existing state to a newly selected backend when changing its storage
- prepare backend and plugin dependencies before planning
- accept an intentional backend configuration change without migrating state
- install externally sourced child modules referenced by the root module
- rerun initialization after adding a provider or changing module sources
Explanation
Correct Answer
D:The practical result of Module download on init, used to install externally sourced child modules referenced by the root module, is: terraform init resolves module sources and downloads them to the local module cache. A qualification for this effect is: Downloading a module does not create its infrastructure.
Incorrect Answers
A:That outcome applies to Backend migration during init, intended to move existing state to a newly selected backend when changing its storage, rather than the question's feature Module download on init: terraform init -migrate-state offers state migration when a backend configuration changes. Unlike Backend migration during init, Module download on init is intended to install externally sourced child modules referenced by the root module, not to move existing state to a newly selected backend when changing its storage.
B:That outcome applies to Initialize a new working directory, intended to prepare backend and plugin dependencies before planning, rather than the question's feature Module download on init: terraform init configures backend access and fetches required modules and providers. Unlike Initialize a new working directory, Module download on init is intended to install externally sourced child modules referenced by the root module, not to prepare backend and plugin dependencies before planning.
C:That outcome applies to Backend reconfiguration during init, intended to accept an intentional backend configuration change without migrating state, rather than the question's feature Module download on init: terraform init -reconfigure disregards the existing backend initialization settings and uses new ones. Unlike Backend reconfiguration during init, Module download on init is intended to install externally sourced child modules referenced by the root module, not to accept an intentional backend configuration change without migrating state.
E:That outcome applies to Initialization as safe repeated step, intended to rerun initialization after adding a provider or changing module sources, rather than the question's feature Module download on init: It is normally safe to run terraform init repeatedly to satisfy updated dependencies. Unlike Initialization as safe repeated step, Module download on init is intended to install externally sourced child modules referenced by the root module, not to rerun initialization after adding a provider or changing module sources.
Question 304
A team reviews the use of terraform -lock-timeout behavior in Terraform 1.12. Which purpose matches its actual behavior?
- identify the precise stale lock before taking exceptional recovery action
- let a run wait briefly rather than fail immediately when state is busy
- protect shared state rather than using -lock=false as a routine workaround
- prevent two concurrent runs from writing the same state snapshot
- select shared state storage with appropriate concurrency semantics
Explanation
Correct Answer
B:The practical result of terraform -lock-timeout behavior, used to let a run wait briefly rather than fail immediately when state is busy, is: The lock-timeout flag controls how long supported operations retry obtaining a lock. A qualification for this effect is: It does not itself activate locking on a backend that lacks that feature.
Incorrect Answers
A:That outcome applies to Lock identifier verification, intended to identify the precise stale lock before taking exceptional recovery action, rather than the question's feature terraform -lock-timeout behavior: A lock ID should be matched to the blocked state operation before unlocking. Unlike Lock identifier verification, terraform -lock-timeout behavior is intended to let a run wait briefly rather than fail immediately when state is busy, not to identify the precise stale lock before taking exceptional recovery action.
C:That outcome applies to Avoid disabling state locks, intended to protect shared state rather than using -lock=false as a routine workaround, rather than the question's feature terraform -lock-timeout behavior: Using a lock-capable backend with normal locking reduces state races. Unlike Avoid disabling state locks, terraform -lock-timeout behavior is intended to let a run wait briefly rather than fail immediately when state is busy, not to protect shared state rather than using -lock=false as a routine workaround.
D:That outcome applies to Terraform state locking, intended to prevent two concurrent runs from writing the same state snapshot, rather than the question's feature terraform -lock-timeout behavior: A backend with locking support serializes operations that could corrupt shared state. Unlike Terraform state locking, terraform -lock-timeout behavior is intended to let a run wait briefly rather than fail immediately when state is busy, not to prevent two concurrent runs from writing the same state snapshot.
E:That outcome applies to Remote backend locking capabilities, intended to select shared state storage with appropriate concurrency semantics, rather than the question's feature terraform -lock-timeout behavior: Supported remote backends can coordinate locking around updates to common state. Unlike Remote backend locking capabilities, terraform -lock-timeout behavior is intended to let a run wait briefly rather than fail immediately when state is busy, not to select shared state storage with appropriate concurrency semantics.
Question 305
A Terraform rollout has two separate requirements: first, translate declarative resources into operations on a platform; second, specify an end state rather than every API request. Which assignment of mechanisms correctly handles both responsibilities?
- First use Terraform resource declaration; then use Idempotent reconciliation.
- First use Infrastructure provider API; then use Declarative infrastructure model.
- First use Idempotent reconciliation; then use Declarative infrastructure model.
- First use Declarative infrastructure model; then use Infrastructure provider API.
- First use Infrastructure provider API; then use Terraform resource declaration.
Explanation
Correct Answer
B:The first requirement, to translate declarative resources into operations on a platform, is handled by Infrastructure provider API: Provider plugins supply resource implementations and call remote APIs when Terraform reconciles infrastructure. The second requirement, to specify an end state rather than every API request, is handled by Declarative infrastructure model: A declarative model states the desired objects and lets Terraform determine an execution path from configuration and state. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to translate declarative resources into operations on a platform and specify an end state rather than every API request, the first candidate Terraform resource declaration addresses describe one managed infrastructure object in a configuration; the second candidate Idempotent reconciliation addresses repeat an apply without recreating already matching resources. This mapping fails because the first mechanism primarily supports the task to describe one managed infrastructure object in a configuration and the second mechanism primarily supports the task to repeat an apply without recreating already matching resources; the actual requirements are translate declarative resources into operations on a platform first and specify an end state rather than every API request second.
C:For the requested tasks to translate declarative resources into operations on a platform and specify an end state rather than every API request, the first candidate Idempotent reconciliation addresses repeat an apply without recreating already matching resources; the second candidate Declarative infrastructure model addresses specify an end state rather than every API request. This mapping fails because the first mechanism primarily supports the task to repeat an apply without recreating already matching resources; the actual requirements are translate declarative resources into operations on a platform first and specify an end state rather than every API request second.
D:For the requested tasks to translate declarative resources into operations on a platform and specify an end state rather than every API request, the first candidate Declarative infrastructure model addresses specify an end state rather than every API request; the second candidate Infrastructure provider API addresses translate declarative resources into operations on a platform. 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 translate declarative resources into operations on a platform; the actual requirements are translate declarative resources into operations on a platform first and specify an end state rather than every API request second.
E:For the requested tasks to translate declarative resources into operations on a platform and specify an end state rather than every API request, the first candidate Infrastructure provider API addresses translate declarative resources into operations on a platform; the second candidate Terraform resource declaration addresses describe one managed infrastructure object in a configuration. This mapping fails because the second mechanism primarily supports the task to describe one managed infrastructure object in a configuration; the actual requirements are translate declarative resources into operations on a platform first and specify an end state rather than every API request second.
Question 306
A Terraform runbook describes the mechanism "Module local values". Which responsibility should a reviewer associate with it?
- pass a caller-defined value into a reusable child module
- keep provider instances configured in the root and pass them to child modules
- make some child module arguments optional for callers
- compute module-specific intermediate values without exporting them
- read values from every instance created by a counted or keyed module call
Explanation
Correct Answer
D:The practical result of Module local values, used to compute module-specific intermediate values without exporting them, is: Local values belong to the defining module and are referenced through local.name in that scope. A qualification for this effect is: They are not automatically exposed through a module output reference.
Incorrect Answers
A:That outcome applies to Child module input variable, intended to pass a caller-defined value into a reusable child module, rather than the question's feature Module local values: The child declares a variable and the parent's module block assigns a value to that argument. Unlike Child module input variable, Module local values is intended to compute module-specific intermediate values without exporting them, not to pass a caller-defined value into a reusable child module.
B:That outcome applies to Provider configuration scope, intended to keep provider instances configured in the root and pass them to child modules, rather than the question's feature Module local values: A root module can explicitly map provider configurations into child module calls. Unlike Provider configuration scope, Module local values is intended to compute module-specific intermediate values without exporting them, not to keep provider instances configured in the root and pass them to child modules.
C:That outcome applies to Module input defaults, intended to make some child module arguments optional for callers, rather than the question's feature Module local values: A child variable with a default can be omitted by the caller, allowing the child to use its fallback. Unlike Module input defaults, Module local values is intended to compute module-specific intermediate values without exporting them, not to make some child module arguments optional for callers.
E:That outcome applies to Module outputs with repeated instances, intended to read values from every instance created by a counted or keyed module call, rather than the question's feature Module local values: Counted module outputs use numeric indices; for_each module outputs use instance keys. Unlike Module outputs with repeated instances, Module local values is intended to compute module-specific intermediate values without exporting them, not to read values from every instance created by a counted or keyed module call.
Question 307
A configuration walkthrough identifies "HCP Terraform variable sets". Which task is it principally intended to support?
- grant workspace access based on collaboration responsibilities
- share approved reusable modules within an organization
- share reusable variables across selected workspaces
- enforce organizational rules during infrastructure runs
- monitor for resources that have diverged from workspace configuration
Explanation
Correct Answer
C:The practical result of HCP Terraform variable sets, used to share reusable variables across selected workspaces, is: Variable sets can provide common Terraform or environment variables to applicable workspaces. A qualification for this effect is: Per-workspace values and precedence must be reviewed when there are overlaps.
Incorrect Answers
A:That outcome applies to HCP Terraform teams and permissions, intended to grant workspace access based on collaboration responsibilities, rather than the question's feature HCP Terraform variable sets: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying. Unlike HCP Terraform teams and permissions, HCP Terraform variable sets is intended to share reusable variables across selected workspaces, not to grant workspace access based on collaboration responsibilities.
B:That outcome applies to HCP Terraform private module registry, intended to share approved reusable modules within an organization, rather than the question's feature HCP Terraform variable sets: A private registry distributes versioned modules to organization workspaces and teams. Unlike HCP Terraform private module registry, HCP Terraform variable sets is intended to share reusable variables across selected workspaces, not to share approved reusable modules within an organization.
D:That outcome applies to HCP Terraform policy sets, intended to enforce organizational rules during infrastructure runs, rather than the question's feature HCP Terraform variable sets: HCP Terraform can evaluate governance policies such as Sentinel or OPA as part of run controls. Unlike HCP Terraform policy sets, HCP Terraform variable sets is intended to share reusable variables across selected workspaces, not to enforce organizational rules during infrastructure runs.
E:That outcome applies to HCP Terraform drift detection, intended to monitor for resources that have diverged from workspace configuration, rather than the question's feature HCP Terraform variable sets: Health assessments can identify drift between tracked resources and desired configuration. Unlike HCP Terraform drift detection, HCP Terraform variable sets is intended to share reusable variables across selected workspaces, not to monitor for resources that have diverged from workspace configuration.
Question 308
A Terraform rollout has two separate requirements: first, run a plan after importing an object to check unexpected updates; second, declare an import target for normal planning and apply. Which assignment of mechanisms correctly handles both responsibilities?
- First use Import resource address matching; then use Import without recreation.
- First use Import validation follow-up; then use Configuration-driven import block.
- First use Import validation follow-up; then use Import resource address matching.
- First use Import without recreation; then use Configuration-driven import block.
- First use Configuration-driven import block; then use Import validation follow-up.
Explanation
Correct Answer
B:The first requirement, to run a plan after importing an object to check unexpected updates, is handled by Import validation follow-up: A post-import plan reveals whether declared settings match the newly adopted remote object. The second requirement, to declare an import target for normal planning and apply, is handled by Configuration-driven import block: An import block can specify a resource address and provider-specific identity for import. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to run a plan after importing an object to check unexpected updates and declare an import target for normal planning and apply, the first candidate Import resource address matching addresses map a discovered object to the intended Terraform resource instance address; the second candidate Import without recreation addresses adopt an existing object rather than creating a new duplicate. This mapping fails because the first mechanism primarily supports the task to map a discovered object to the intended Terraform resource instance address and the second mechanism primarily supports the task to adopt an existing object rather than creating a new duplicate; the actual requirements are run a plan after importing an object to check unexpected updates first and declare an import target for normal planning and apply second.
C:For the requested tasks to run a plan after importing an object to check unexpected updates and declare an import target for normal planning and apply, the first candidate Import validation follow-up addresses run a plan after importing an object to check unexpected updates; the second candidate Import resource address matching addresses map a discovered object to the intended Terraform resource instance address. This mapping fails because the second mechanism primarily supports the task to map a discovered object to the intended Terraform resource instance address; the actual requirements are run a plan after importing an object to check unexpected updates first and declare an import target for normal planning and apply second.
D:For the requested tasks to run a plan after importing an object to check unexpected updates and declare an import target for normal planning and apply, the first candidate Import without recreation addresses adopt an existing object rather than creating a new duplicate; the second candidate Configuration-driven import block addresses declare an import target for normal planning and apply. This mapping fails because the first mechanism primarily supports the task to adopt an existing object rather than creating a new duplicate; the actual requirements are run a plan after importing an object to check unexpected updates first and declare an import target for normal planning and apply second.
E:For the requested tasks to run a plan after importing an object to check unexpected updates and declare an import target for normal planning and apply, the first candidate Configuration-driven import block addresses declare an import target for normal planning and apply; the second candidate Import validation follow-up addresses run a plan after importing an object to check unexpected updates. 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 run a plan after importing an object to check unexpected updates; the actual requirements are run a plan after importing an object to check unexpected updates first and declare an import target for normal planning and apply second.
Question 309
An engineer must update an existing Terraform workflow to prompt for or provide a root-module value when no default exists. Which mechanism most directly meets this particular need?
- Output block
- Variable file input
- Required input variable
- Variable source precedence
Explanation
Correct Answer
C:The task is to prompt for or provide a root-module value when no default exists; Required input variable directly supports that requirement: A variable block without a default requires a value supplied through a supported input channel. Its relevant boundary is: Declaring a variable does not itself fetch a remote API value.
Incorrect Answers
A:Output block is designed to expose a selected Terraform expression to the caller or CLI, whereas this task is to prompt for or provide a root-module value when no default exists: An output block publishes a value from its module, such as an endpoint or resource identifier. Against Required input variable, its limitation is: Outputs do not automatically create an infrastructure object.
B:Variable file input is designed to load multiple variable assignments from a chosen tfvars file, whereas this task is to prompt for or provide a root-module value when no default exists: The -var-file flag passes root-module input values from a named variable definitions file. Against Required input variable, its limitation is: The file supplies values but does not declare variable types.
D:Variable source precedence is designed to override environment or tfvars values with an explicit CLI variable flag, whereas this task is to prompt for or provide a root-module value when no default exists: Direct -var and -var-file command-line assignments have precedence over automatically loaded values. Against Required input variable, its limitation is: Input precedence does not grant the variable a new scope inside child modules.
Question 310
A design uses Module download on init to install externally sourced child modules referenced by the root module. Which qualification applies to the named mechanism?
- Initialization is not the command for creating managed resources.
- It does not automatically move the old state into the new backend.
- Downloading a module does not create its infrastructure.
- Reinitialization is not a substitute for planning after configuration changes.
Explanation
Correct Answer
C:For Module download on init in the task to install externally sourced child modules referenced by the root module, the important caution is: Downloading a module does not create its infrastructure. The reason this matters is its actual behavior: terraform init resolves module sources and downloads them to the local module cache.
Incorrect Answers
A:The proposed warning belongs to Initialize a new working directory, which serves the different goal to prepare backend and plugin dependencies before planning, rather than to Module download on init: terraform init configures backend access and fetches required modules and providers. The question concerns Module download on init acting to install externally sourced child modules referenced by the root module, not a limit of Initialize a new working directory.
B:The proposed warning belongs to Backend reconfiguration during init, which serves the different goal to accept an intentional backend configuration change without migrating state, rather than to Module download on init: terraform init -reconfigure disregards the existing backend initialization settings and uses new ones. The question concerns Module download on init acting to install externally sourced child modules referenced by the root module, not a limit of Backend reconfiguration during init.
D:The listed caution belongs specifically to Initialization as safe repeated step, used to rerun initialization after adding a provider or changing module sources: It is normally safe to run terraform init repeatedly to satisfy updated dependencies; the feature under review is instead Module download on init, so this answer attaches another feature's qualification to the wrong mechanism.