Question 320
Before adopting Required input variable to prompt for or provide a root-module value when no default exists, which statement sets an accurate boundary?
- Input precedence does not grant the variable a new scope inside child modules.
- Outputs do not automatically create an infrastructure object.
- Declaring a variable does not itself fetch a remote API value.
- The file supplies values but does not declare variable types.
Explanation
Correct Answer
C:For Required input variable in the task to prompt for or provide a root-module value when no default exists, the important caution is: Declaring a variable does not itself fetch a remote API value. The reason this matters is its actual behavior: A variable block without a default requires a value supplied through a supported input channel.
Incorrect Answers
A:The proposed warning belongs to Variable source precedence, which serves the different goal to override environment or tfvars values with an explicit CLI variable flag, rather than to Required input variable: Direct -var and -var-file command-line assignments have precedence over automatically loaded values. The question concerns Required input variable acting to prompt for or provide a root-module value when no default exists, not a limit of Variable source precedence.
B:The proposed warning belongs to Output block, which serves the different goal to expose a selected Terraform expression to the caller or CLI, rather than to Required input variable: An output block publishes a value from its module, such as an endpoint or resource identifier. The question concerns Required input variable acting to prompt for or provide a root-module value when no default exists, not a limit of Output block.
D:The proposed warning belongs to Variable file input, which serves the different goal to load multiple variable assignments from a chosen tfvars file, rather than to Required input variable: The -var-file flag passes root-module input values from a named variable definitions file. The question concerns Required input variable acting to prompt for or provide a root-module value when no default exists, not a limit of Variable file input.
Question 321
The implementation must both compute module-specific intermediate values without exporting them and make some child module arguments optional for callers. Which TWO mechanisms directly address these two separate requirements? Choose TWO.
- Child module input variable
- Root variable namespace
- Child module output scope
- Module input defaults
- Module local values
Explanation
Correct Answers
D:Among the paired tasks to compute module-specific intermediate values without exporting them and make some child module arguments optional for callers, Module input defaults serves the requirement to make some child module arguments optional for callers: A child variable with a default can be omitted by the caller, allowing the child to use its fallback. The other task must be covered by a separate mechanism.
E:Among the paired tasks to compute module-specific intermediate values without exporting them and make some child module arguments optional for callers, Module local values serves the requirement to compute module-specific intermediate values without exporting them: Local values belong to the defining module and are referenced through local.name in that scope. The other task must be covered by a separate mechanism.
Incorrect Answers
A:The requirements are compute module-specific intermediate values without exporting them and make some child module arguments optional for callers, while Child module input variable supports the different task to pass a caller-defined value into a reusable child module: The child declares a variable and the parent's module block assigns a value to that argument. That capability is outside the two selected responsibilities.
B:The requirements are compute module-specific intermediate values without exporting them and make some child module arguments optional for callers, while Root variable namespace supports the different task to distinguish CLI-supplied root inputs from child inputs: CLI -var arguments set variables declared in the root module; child values pass through module call arguments. That capability is outside the two selected responsibilities.
C:The requirements are compute module-specific intermediate values without exporting them and make some child module arguments optional for callers, while Child module output scope supports the different task to expose specific child values to its parent with an output block: The parent can use module.child.output_name only when the child explicitly declares that output. That capability is outside the two selected responsibilities.
Question 322
A Terraform rollout has two separate requirements: first, share reusable variables across selected workspaces; second, avoid long-lived static cloud credentials in workspace variables. Which assignment of mechanisms correctly handles both responsibilities?
- First use HCP Terraform auditability; then use HCP Terraform private module registry.
- First use HCP Terraform variable sets; then use HCP Terraform auditability.
- First use HCP Terraform variable sets; then use HCP Terraform dynamic provider credentials.
- First use HCP Terraform private module registry; then use HCP Terraform dynamic provider credentials.
- First use HCP Terraform dynamic provider credentials; then use HCP Terraform variable sets.
Explanation
Correct Answer
C:The first requirement, to share reusable variables across selected workspaces, is handled by HCP Terraform variable sets: Variable sets can provide common Terraform or environment variables to applicable workspaces. The second requirement, to avoid long-lived static cloud credentials in workspace variables, is handled by HCP Terraform dynamic provider credentials: Supported dynamic credentials issue time-limited tokens to runs based on trust configuration. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to share reusable variables across selected workspaces and avoid long-lived static cloud credentials in workspace variables, the first candidate HCP Terraform auditability addresses retain run and change history for collaboration and review; 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 retain run and change history for collaboration and review and the second mechanism primarily supports the task to share approved reusable modules within an organization; the actual requirements are share reusable variables across selected workspaces first and avoid long-lived static cloud credentials in workspace variables second.
B:For the requested tasks to share reusable variables across selected workspaces and avoid long-lived static cloud credentials in workspace variables, the first candidate HCP Terraform variable sets addresses share reusable variables across selected workspaces; the second candidate HCP Terraform auditability addresses retain run and change history for collaboration and review. This mapping fails because the second mechanism primarily supports the task to retain run and change history for collaboration and review; the actual requirements are share reusable variables across selected workspaces first and avoid long-lived static cloud credentials in workspace variables second.
D:For the requested tasks to share reusable variables across selected workspaces and avoid long-lived static cloud credentials in workspace variables, the first candidate HCP Terraform private module registry addresses share approved reusable modules within an organization; the second candidate HCP Terraform dynamic provider credentials addresses avoid long-lived static cloud credentials in workspace variables. This mapping fails because the first mechanism primarily supports the task to share approved reusable modules within an organization; the actual requirements are share reusable variables across selected workspaces first and avoid long-lived static cloud credentials in workspace variables second.
E:For the requested tasks to share reusable variables across selected workspaces and avoid long-lived static cloud credentials in workspace variables, the first candidate HCP Terraform dynamic provider credentials addresses avoid long-lived static cloud credentials in workspace variables; the second candidate HCP Terraform variable sets addresses share reusable variables across selected workspaces. This mapping fails because the first mechanism primarily supports the task to avoid long-lived static cloud credentials in workspace variables and the second mechanism primarily supports the task to share reusable variables across selected workspaces; the actual requirements are share reusable variables across selected workspaces first and avoid long-lived static cloud credentials in workspace variables second.
Question 323
A colleague recommends the Terraform concept "Provider plugin responsibility". Which use case best matches it?
- define the supported arguments and attributes for one resource type
- resolve all referenced provider plugins before planning
- associate a resource with the default provider for its type prefix
- translate a Terraform resource operation into remote service API calls
Explanation
Correct Answer
D:The practical result of Provider plugin responsibility, used to translate a Terraform resource operation into remote service API calls, is: The provider implements resource types and performs create, read, update, and delete operations when supported. A qualification for this effect is: Terraform itself does not create a cloud instance without an appropriate provider.
Incorrect Answers
A:That outcome applies to Provider resource schema, intended to define the supported arguments and attributes for one resource type, rather than the question's feature Provider plugin responsibility: The provider schema specifies which settings users can configure and which values are computed. Unlike Provider resource schema, Provider plugin responsibility is intended to translate a Terraform resource operation into remote service API calls, not to define the supported arguments and attributes for one resource type.
B:That outcome applies to Plugin dependency installation, intended to resolve all referenced provider plugins before planning, rather than the question's feature Provider plugin responsibility: An initialized working directory has the plugins required for its configured resources and data sources. Unlike Plugin dependency installation, Provider plugin responsibility is intended to translate a Terraform resource operation into remote service API calls, not to resolve all referenced provider plugins before planning.
C:That outcome applies to Provider selection for resource prefix, intended to associate a resource with the default provider for its type prefix, rather than the question's feature Provider plugin responsibility: Without a provider meta-argument Terraform normally selects the matching local provider configuration. Unlike Provider selection for resource prefix, Provider plugin responsibility is intended to translate a Terraform resource operation into remote service API calls, not to associate a resource with the default provider for its type prefix.
Question 324
A Terraform rollout has two separate requirements: first, prompt for or provide a root-module value when no default exists; second, give a module input a fallback when callers omit it. Which assignment of mechanisms correctly handles both responsibilities?
- First use Variable default value; then use Required input variable.
- First use Required input variable; then use Variable default value.
- First use Local value expression; then use Output block.
- First use Required input variable; then use Local value expression.
- First use Output block; then use Variable default value.
Explanation
Correct Answer
B:The first requirement, to prompt for or provide a root-module value when no default exists, is handled by Required input variable: A variable block without a default requires a value supplied through a supported input channel. The second requirement, to give a module input a fallback when callers omit it, is handled by Variable default value: A variable default supplies a value without requiring each caller to pass that argument. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to prompt for or provide a root-module value when no default exists and give a module input a fallback when callers omit it, the first candidate Variable default value addresses give a module input a fallback when callers omit it; the second candidate Required input variable addresses prompt for or provide a root-module value when no default exists. This mapping fails because the first mechanism primarily supports the task to give a module input a fallback when callers omit it and the second mechanism primarily supports the task to prompt for or provide a root-module value when no default exists; the actual requirements are prompt for or provide a root-module value when no default exists first and give a module input a fallback when callers omit it second.
C:For the requested tasks to prompt for or provide a root-module value when no default exists and give a module input a fallback when callers omit it, the first candidate Local value expression addresses name a computed expression used repeatedly inside one module; the second candidate Output block addresses expose a selected Terraform expression to the caller or CLI. This mapping fails because the first mechanism primarily supports the task to name a computed expression used repeatedly inside one module and the second mechanism primarily supports the task to expose a selected Terraform expression to the caller or CLI; the actual requirements are prompt for or provide a root-module value when no default exists first and give a module input a fallback when callers omit it second.
D:For the requested tasks to prompt for or provide a root-module value when no default exists and give a module input a fallback when callers omit it, the first candidate Required input variable addresses prompt for or provide a root-module value when no default exists; the second candidate Local value expression addresses name a computed expression used repeatedly inside one module. This mapping fails because the second mechanism primarily supports the task to name a computed expression used repeatedly inside one module; the actual requirements are prompt for or provide a root-module value when no default exists first and give a module input a fallback when callers omit it second.
E:For the requested tasks to prompt for or provide a root-module value when no default exists and give a module input a fallback when callers omit it, the first candidate Output block addresses expose a selected Terraform expression to the caller or CLI; the second candidate Variable default value addresses give a module input a fallback when callers omit it. This mapping fails because the first mechanism primarily supports the task to expose a selected Terraform expression to the caller or CLI; the actual requirements are prompt for or provide a root-module value when no default exists first and give a module input a fallback when callers omit it second.
Question 325
During a Terraform 1.12 implementation, the immediate requirement is to rerun initialization after adding a provider or changing module sources. Which mechanism most directly meets this particular need?
- Init without backend setup
- Init provider plugin upgrade control
- Module download on init
- Initialization as safe repeated step
Explanation
Correct Answer
D:The task is to rerun initialization after adding a provider or changing module sources; Initialization as safe repeated step directly supports that requirement: It is normally safe to run terraform init repeatedly to satisfy updated dependencies. Its relevant boundary is: Reinitialization is not a substitute for planning after configuration changes.
Incorrect Answers
A:Init without backend setup is designed to work on configuration validation while deliberately skipping backend initialization, whereas this task is to rerun initialization after adding a provider or changing module sources: terraform init -backend=false skips the backend initialization step where appropriate. Against Initialization as safe repeated step, its limitation is: Commands needing live state might not work without a configured backend.
B:Init provider plugin upgrade control is designed to preserve locked provider selections in routine CI initialization, whereas this task is to rerun initialization after adding a provider or changing module sources: A normal terraform init honors the existing dependency lock selections unless update is requested. Against Initialization as safe repeated step, its limitation is: A changed constraint can require an explicit upgrade or other resolution.
C:Module download on init is designed to install externally sourced child modules referenced by the root module, whereas this task is to rerun initialization after adding a provider or changing module sources: terraform init resolves module sources and downloads them to the local module cache. Against Initialization as safe repeated step, its limitation is: Downloading a module does not create its infrastructure.
Question 326
A reviewer is asked to choose a mechanism to protect shared state rather than using -lock=false as a routine workaround. Which mechanism most directly meets this particular need?
- Lock acquisition before writes
- terraform -lock-timeout behavior
- Terraform state locking
- Avoid disabling state locks
- Lock identifier verification
Explanation
Correct Answer
D:The task is to protect shared state rather than using -lock=false as a routine workaround; Avoid disabling state locks directly supports that requirement: Using a lock-capable backend with normal locking reduces state races. Its relevant boundary is: -lock=false makes concurrent writers potentially unsafe.
Incorrect Answers
A:Lock acquisition before writes is designed to avoid racing state mutations when several operators run Terraform, whereas this task is to protect shared state rather than using -lock=false as a routine workaround: Terraform tries to obtain a state lock when the chosen backend supports it. Against Avoid disabling state locks, its limitation is: A configuration-only validation step typically does not need to change state.
B:terraform -lock-timeout behavior is designed to let a run wait briefly rather than fail immediately when state is busy, whereas this task is to protect shared state rather than using -lock=false as a routine workaround: The lock-timeout flag controls how long supported operations retry obtaining a lock. Against Avoid disabling state locks, its limitation is: It does not itself activate locking on a backend that lacks that feature.
C:Terraform state locking is designed to prevent two concurrent runs from writing the same state snapshot, whereas this task is to protect shared state rather than using -lock=false as a routine workaround: A backend with locking support serializes operations that could corrupt shared state. Against Avoid disabling state locks, its limitation is: Not every backend supports locking in the same way.
E:Lock identifier verification addresses the different requirement to identify the precise stale lock before taking exceptional recovery action: A lock ID should be matched to the blocked state operation before unlocking; this does not by itself satisfy the requested task to protect shared state rather than using -lock=false as a routine workaround. For the stated need, Avoid disabling state locks is the more direct mechanism.
Question 327
A configuration walkthrough identifies "Version-controlled configuration history". Which task is it principally intended to support?
- trace why infrastructure definitions changed
- require approval before risky infrastructure changes
- replace repetitive click-by-click resource deployment with a pipeline
- recreate equivalent infrastructure patterns from one codebase
Explanation
Correct Answer
A:The practical result of Version-controlled configuration history, used to trace why infrastructure definitions changed, is: Git commits and pull requests make configuration edits auditable before the next Terraform run. A qualification for this effect is: A Git diff tracks source files rather than proving the exact live infrastructure state.
Incorrect Answers
B:That outcome applies to Peer review for infrastructure, intended to require approval before risky infrastructure changes, rather than the question's feature Version-controlled configuration history: Text configuration can be reviewed through a normal code review before an approved apply. Unlike Peer review for infrastructure, Version-controlled configuration history is intended to trace why infrastructure definitions changed, not to require approval before risky infrastructure changes.
C:That outcome applies to Automated provisioning pipeline, intended to replace repetitive click-by-click resource deployment with a pipeline, rather than the question's feature Version-controlled configuration history: A CI pipeline can run validation and planning before an authorized apply, reducing procedural inconsistency. Unlike Automated provisioning pipeline, Version-controlled configuration history is intended to trace why infrastructure definitions changed, not to replace repetitive click-by-click resource deployment with a pipeline.
D:That outcome applies to Repeatable environment provisioning, intended to recreate equivalent infrastructure patterns from one codebase, rather than the question's feature Version-controlled configuration history: Parameterizing reusable Terraform modules can provision consistent environment patterns repeatedly. Unlike Repeatable environment provisioning, Version-controlled configuration history is intended to trace why infrastructure definitions changed, not to recreate equivalent infrastructure patterns from one codebase.
Question 328
A Terraform operator is specifically tasked to keep provider instances configured in the root and pass them to child modules. Which mechanism most directly meets this particular need?
- Child module output scope
- Provider configuration scope
- Child module input variable
- Root variable namespace
Explanation
Correct Answer
B:The task is to keep provider instances configured in the root and pass them to child modules; Provider configuration scope directly supports that requirement: A root module can explicitly map provider configurations into child module calls. Its relevant boundary is: An aliased provider is not automatically inherited as a child alias.
Incorrect Answers
A:Child module output scope is designed to expose specific child values to its parent with an output block, whereas this task is to keep provider instances configured in the root and pass them to child modules: The parent can use module.child.output_name only when the child explicitly declares that output. Against Provider configuration scope, its limitation is: Internal child locals and resource attributes remain encapsulated by default.
C:Child module input variable is designed to pass a caller-defined value into a reusable child module, whereas this task is to keep provider instances configured in the root and pass them to child modules: The child declares a variable and the parent's module block assigns a value to that argument. Against Provider configuration scope, its limitation is: An input declared in the child is not implicitly available as var.name in the parent.
D:Root variable namespace is designed to distinguish CLI-supplied root inputs from child inputs, whereas this task is to keep provider instances configured in the root and pass them to child modules: CLI -var arguments set variables declared in the root module; child values pass through module call arguments. Against Provider configuration scope, its limitation is: A variable with the same name in two modules is a separate declaration.
Question 329
A team is adjusting its declarative infrastructure process to monitor for resources that have diverged from workspace configuration. Which mechanism most directly meets this particular need?
- HCP Terraform auditability
- HCP Terraform variable sets
- HCP Terraform dynamic provider credentials
- HCP Terraform drift detection
Explanation
Correct Answer
D:The task is to monitor for resources that have diverged from workspace configuration; HCP Terraform drift detection directly supports that requirement: Health assessments can identify drift between tracked resources and desired configuration. Its relevant boundary is: HCP Terraform health assessments require Standard or Premium edition and an eligible workspace; detection itself does not automatically correct drift.
Incorrect Answers
A:HCP Terraform auditability is designed to retain run and change history for collaboration and review, whereas this task is to monitor for resources that have diverged from workspace configuration: Workspace run histories help teams trace proposed and executed infrastructure operations. Against HCP Terraform drift detection, its limitation is: A recorded run history is not the same as versioned source code approval.
B:HCP Terraform variable sets is designed to share reusable variables across selected workspaces, whereas this task is to monitor for resources that have diverged from workspace configuration: Variable sets can provide common Terraform or environment variables to applicable workspaces. Against HCP Terraform drift detection, its limitation is: Per-workspace values and precedence must be reviewed when there are overlaps.
C:HCP Terraform dynamic provider credentials is designed to avoid long-lived static cloud credentials in workspace variables, whereas this task is to monitor for resources that have diverged from workspace configuration: Supported dynamic credentials issue time-limited tokens to runs based on trust configuration. Against HCP Terraform drift detection, its limitation is: The target provider and cloud identity federation must be configured correctly.
Question 330
A configuration walkthrough identifies "terraform state list". Which task is it principally intended to support?
- export state or saved plan information in machine-readable form
- inspect stored attributes for one tracked resource instance
- enumerate Terraform resource addresses currently tracked in a state snapshot
- inspect the latest state or a saved execution plan in readable form
Explanation
Correct Answer
C:The practical result of terraform state list, used to enumerate Terraform resource addresses currently tracked in a state snapshot, is: state list displays managed addresses and can be narrowed with address filters. A qualification for this effect is: It does not enumerate every object in the cloud account.
Incorrect Answers
A:That outcome applies to terraform show -json, intended to export state or saved plan information in machine-readable form, rather than the question's feature terraform state list: show -json emits detailed JSON for supported state and plan representations. Unlike terraform show -json, terraform state list is intended to enumerate Terraform resource addresses currently tracked in a state snapshot, not to export state or saved plan information in machine-readable form.
B:That outcome applies to terraform state show ADDRESS, intended to inspect stored attributes for one tracked resource instance, rather than the question's feature terraform state list: state show presents the state representation of an addressed resource. Unlike terraform state show ADDRESS, terraform state list is intended to enumerate Terraform resource addresses currently tracked in a state snapshot, not to inspect stored attributes for one tracked resource instance.
D:That outcome applies to terraform show, intended to inspect the latest state or a saved execution plan in readable form, rather than the question's feature terraform state list: terraform show can display an existing state snapshot or a named plan file. Unlike terraform show, terraform state list is intended to enumerate Terraform resource addresses currently tracked in a state snapshot, not to inspect the latest state or a saved execution plan in readable form.