Question 350
A Terraform rollout has two separate requirements: first, keep provider instances configured in the root and pass them to child modules; second, read values from every instance created by a counted or keyed module call. Which assignment of mechanisms correctly handles both responsibilities?
- First use Child module output scope; then use Module outputs with repeated instances.
- First use Child module input variable; then use Child module output scope.
- First use Provider configuration scope; then use Module outputs with repeated instances.
- First use Module outputs with repeated instances; then use Provider configuration scope.
- First use Provider configuration scope; then use Child module input variable.
Explanation
Correct Answer
C:The first requirement, to keep provider instances configured in the root and pass them to child modules, is handled by Provider configuration scope: A root module can explicitly map provider configurations into child module calls. The second requirement, to read values from every instance created by a counted or keyed module call, is handled by Module outputs with repeated instances: Counted module outputs use numeric indices; for_each module outputs use instance keys. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to keep provider instances configured in the root and pass them to child modules and read values from every instance created by a counted or keyed module call, the first candidate Child module output scope addresses expose specific child values to its parent with an output block; the second candidate Module outputs with repeated instances addresses read values from every instance created by a counted or keyed module call. This mapping fails because the first mechanism primarily supports the task to expose specific child values to its parent with an output block; the actual requirements are keep provider instances configured in the root and pass them to child modules first and read values from every instance created by a counted or keyed module call second.
B:For the requested tasks to keep provider instances configured in the root and pass them to child modules and read values from every instance created by a counted or keyed module call, the first candidate Child module input variable addresses pass a caller-defined value into a reusable child module; the second candidate Child module output scope addresses expose specific child values to its parent with an output block. This mapping fails because the first mechanism primarily supports the task to pass a caller-defined value into a reusable child module and the second mechanism primarily supports the task to expose specific child values to its parent with an output block; the actual requirements are keep provider instances configured in the root and pass them to child modules first and read values from every instance created by a counted or keyed module call second.
D:For the requested tasks to keep provider instances configured in the root and pass them to child modules and read values from every instance created by a counted or keyed module call, the first candidate Module outputs with repeated instances addresses read values from every instance created by a counted or keyed module call; 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 read values from every instance created by a counted or keyed module call 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 keep provider instances configured in the root and pass them to child modules first and read values from every instance created by a counted or keyed module call second.
E:For the requested tasks to keep provider instances configured in the root and pass them to child modules and read values from every instance created by a counted or keyed module call, the first candidate Provider configuration scope addresses keep provider instances configured in the root and pass them to child modules; the second candidate Child module input variable addresses pass a caller-defined value into a reusable child module. This mapping fails because the second mechanism primarily supports the task to pass a caller-defined value into a reusable child module; the actual requirements are keep provider instances configured in the root and pass them to child modules first and read values from every instance created by a counted or keyed module call second.
Question 351
A Terraform rollout has two separate requirements: first, monitor for resources that have diverged from workspace configuration; second, retain run and change history for collaboration and review. Which assignment of mechanisms correctly handles both responsibilities?
- First use HCP Terraform policy sets; then use HCP Terraform auditability.
- First use HCP Terraform auditability; then use HCP Terraform drift detection.
- First use HCP Terraform drift detection; then use HCP Terraform auditability.
- First use HCP Terraform private module registry; then use HCP Terraform policy sets.
- First use HCP Terraform drift detection; then use HCP Terraform private module registry.
Explanation
Correct Answer
C:The first requirement, to monitor for resources that have diverged from workspace configuration, is handled by HCP Terraform drift detection: Health assessments can identify drift between tracked resources and desired configuration. The second requirement, to retain run and change history for collaboration and review, is handled by HCP Terraform auditability: Workspace run histories help teams trace proposed and executed infrastructure operations. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to monitor for resources that have diverged from workspace configuration and retain run and change history for collaboration and review, the first candidate HCP Terraform policy sets addresses enforce organizational rules during infrastructure runs; the second candidate HCP Terraform auditability addresses retain run and change history for collaboration and review. This mapping fails because the first mechanism primarily supports the task to enforce organizational rules during infrastructure runs; the actual requirements are monitor for resources that have diverged from workspace configuration first and retain run and change history for collaboration and review second.
B:For the requested tasks to monitor for resources that have diverged from workspace configuration and retain run and change history for collaboration and review, the first candidate HCP Terraform auditability addresses retain run and change history for collaboration and review; 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 retain run and change history for collaboration and review and the second mechanism primarily supports the task to monitor for resources that have diverged from workspace configuration; the actual requirements are monitor for resources that have diverged from workspace configuration first and retain run and change history for collaboration and review second.
D:For the requested tasks to monitor for resources that have diverged from workspace configuration and retain run and change history for collaboration and review, the first candidate HCP Terraform private module registry addresses share approved reusable modules within an organization; the second candidate HCP Terraform policy sets addresses enforce organizational rules during infrastructure runs. This mapping fails because the first mechanism primarily supports the task to share approved reusable modules within an organization and the second mechanism primarily supports the task to enforce organizational rules during infrastructure runs; the actual requirements are monitor for resources that have diverged from workspace configuration first and retain run and change history for collaboration and review second.
E:For the requested tasks to monitor for resources that have diverged from workspace configuration and retain run and change history for collaboration and review, the first candidate HCP Terraform drift detection addresses monitor for resources that have diverged from workspace configuration; the second candidate HCP Terraform private module registry addresses share approved reusable modules within an organization. This mapping fails because the second mechanism primarily supports the task to share approved reusable modules within an organization; the actual requirements are monitor for resources that have diverged from workspace configuration first and retain run and change history for collaboration and review second.
Question 352
A Terraform rollout has two separate requirements: first, enumerate Terraform resource addresses currently tracked in a state snapshot; second, inspect the latest state or a saved execution plan in readable form. Which assignment of mechanisms correctly handles both responsibilities?
- First use terraform state pull; then use terraform show.
- First use terraform state list; then use terraform show.
- First use terraform show -json; then use terraform state pull.
- First use terraform show; then use terraform state list.
- First use terraform state list; then use terraform show -json.
Explanation
Correct Answer
B:The first requirement, to enumerate Terraform resource addresses currently tracked in a state snapshot, is handled by terraform state list: state list displays managed addresses and can be narrowed with address filters. The second requirement, to inspect the latest state or a saved execution plan in readable form, is handled by terraform show: terraform show can display an existing state snapshot or a named plan file. Each of these mechanisms has a distinct responsibility.
Incorrect Answers
A:For the requested tasks to enumerate Terraform resource addresses currently tracked in a state snapshot and inspect the latest state or a saved execution plan in readable form, the first candidate terraform state pull addresses retrieve the current backend state snapshot as serialized JSON; the second candidate terraform show addresses inspect the latest state or a saved execution plan in readable form. This mapping fails because the first mechanism primarily supports the task to retrieve the current backend state snapshot as serialized JSON; the actual requirements are enumerate Terraform resource addresses currently tracked in a state snapshot first and inspect the latest state or a saved execution plan in readable form second.
C:For the requested tasks to enumerate Terraform resource addresses currently tracked in a state snapshot and inspect the latest state or a saved execution plan in readable form, the first candidate terraform show -json addresses export state or saved plan information in machine-readable form; the second candidate terraform state pull addresses retrieve the current backend state snapshot as serialized JSON. This mapping fails because the first mechanism primarily supports the task to export state or saved plan information in machine-readable form and the second mechanism primarily supports the task to retrieve the current backend state snapshot as serialized JSON; the actual requirements are enumerate Terraform resource addresses currently tracked in a state snapshot first and inspect the latest state or a saved execution plan in readable form second.
D:For the requested tasks to enumerate Terraform resource addresses currently tracked in a state snapshot and inspect the latest state or a saved execution plan in readable form, the first candidate terraform show addresses inspect the latest state or a saved execution plan in readable form; the second candidate terraform state list addresses enumerate Terraform resource addresses currently tracked in a state snapshot. This mapping fails because the first mechanism primarily supports the task to inspect the latest state or a saved execution plan in readable form and the second mechanism primarily supports the task to enumerate Terraform resource addresses currently tracked in a state snapshot; the actual requirements are enumerate Terraform resource addresses currently tracked in a state snapshot first and inspect the latest state or a saved execution plan in readable form second.
E:For the requested tasks to enumerate Terraform resource addresses currently tracked in a state snapshot and inspect the latest state or a saved execution plan in readable form, the first candidate terraform state list addresses enumerate Terraform resource addresses currently tracked in a state snapshot; the second candidate terraform show -json addresses export state or saved plan information in machine-readable form. This mapping fails because the second mechanism primarily supports the task to export state or saved plan information in machine-readable form; the actual requirements are enumerate Terraform resource addresses currently tracked in a state snapshot first and inspect the latest state or a saved execution plan in readable form second.
Question 353
A configuration review identifies the need to give a module input a fallback when callers omit it. Which mechanism most directly meets this particular need?
- Variable source precedence
- Variable file input
- Output block
- Variable default value
Explanation
Correct Answer
D:The task is to give a module input a fallback when callers omit it; Variable default value directly supports that requirement: A variable default supplies a value without requiring each caller to pass that argument. Its relevant boundary is: Explicit callers can override the default with their own value.
Incorrect Answers
A:Variable source precedence is designed to override environment or tfvars values with an explicit CLI variable flag, whereas this task is to give a module input a fallback when callers omit it: Direct -var and -var-file command-line assignments have precedence over automatically loaded values. Against Variable default value, its limitation is: Input precedence does not grant the variable a new scope inside child modules.
B:Variable file input is designed to load multiple variable assignments from a chosen tfvars file, whereas this task is to give a module input a fallback when callers omit it: The -var-file flag passes root-module input values from a named variable definitions file. Against Variable default value, its limitation is: The file supplies values but does not declare variable types.
C:Output block is designed to expose a selected Terraform expression to the caller or CLI, whereas this task is to give a module input a fallback when callers omit it: An output block publishes a value from its module, such as an endpoint or resource identifier. Against Variable default value, its limitation is: Outputs do not automatically create an infrastructure object.
Question 354
A reviewer is asked to choose a mechanism to work on configuration validation while deliberately skipping backend initialization. Which mechanism most directly meets this particular need?
- Initialize a new working directory
- Backend reconfiguration during init
- Init without backend setup
- Module download on init
- Initialization as safe repeated step
Explanation
Correct Answer
C:The task is to work on configuration validation while deliberately skipping backend initialization; Init without backend setup directly supports that requirement: terraform init -backend=false skips the backend initialization step where appropriate. Its relevant boundary is: Commands needing live state might not work without a configured backend.
Incorrect Answers
A:Initialize a new working directory is designed to prepare backend and plugin dependencies before planning, whereas this task is to work on configuration validation while deliberately skipping backend initialization: terraform init configures backend access and fetches required modules and providers. Against Init without backend setup, its limitation is: Initialization is not the command for creating managed resources.
B:Backend reconfiguration during init is designed to accept an intentional backend configuration change without migrating state, whereas this task is to work on configuration validation while deliberately skipping backend initialization: terraform init -reconfigure disregards the existing backend initialization settings and uses new ones. Against Init without backend setup, its limitation is: It does not automatically move the old state into the new backend.
D:Module download on init is designed to install externally sourced child modules referenced by the root module, whereas this task is to work on configuration validation while deliberately skipping backend initialization: terraform init resolves module sources and downloads them to the local module cache. Against Init without backend setup, its limitation is: Downloading a module does not create its infrastructure.
E:Initialization as safe repeated step addresses the different requirement to rerun initialization after adding a provider or changing module sources: It is normally safe to run terraform init repeatedly to satisfy updated dependencies; this does not by itself satisfy the requested task to work on configuration validation while deliberately skipping backend initialization. For the stated need, Init without backend setup is the more direct mechanism.
Question 355
For a new infrastructure repository, the team wants to supply settings such as region or endpoint for a provider instance. Which mechanism most directly meets this particular need?
- Provider plugin responsibility
- Provider resource schema
- Provider block configuration
- Provider authentication
- Provider data sources
Explanation
Correct Answer
C:The task is to supply settings such as region or endpoint for a provider instance; Provider block configuration directly supports that requirement: A provider block creates a configured provider instance that resources can use. Its relevant boundary is: It does not determine which provider package source gets installed.
Incorrect Answers
A:Provider plugin responsibility is designed to translate a Terraform resource operation into remote service API calls, whereas this task is to supply settings such as region or endpoint for a provider instance: The provider implements resource types and performs create, read, update, and delete operations when supported. Against Provider block configuration, its limitation is: Terraform itself does not create a cloud instance without an appropriate provider.
B:Provider resource schema is designed to define the supported arguments and attributes for one resource type, whereas this task is to supply settings such as region or endpoint for a provider instance: The provider schema specifies which settings users can configure and which values are computed. Against Provider block configuration, its limitation is: A generic Terraform language feature cannot invent unsupported provider arguments.
D:Provider authentication is designed to authorize API operations requested by a Terraform provider, whereas this task is to supply settings such as region or endpoint for a provider instance: Providers use supported credentials and authentication mechanisms to talk to their services. Against Provider block configuration, its limitation is: Successful terraform validate does not guarantee those credentials can reach an API.
E:Provider data sources is designed to read remote information without declaring ownership of its lifecycle, whereas this task is to supply settings such as region or endpoint for a provider instance: A provider data source queries external information that configuration can reference. Against Provider block configuration, its limitation is: It generally does not create or destroy the looked-up object.
Question 356
A team is adjusting its declarative infrastructure process to identify the precise stale lock before taking exceptional recovery action. Which mechanism most directly meets this particular need?
- Lock identifier verification
- Remote backend locking capabilities
- Terraform state locking
- Avoid disabling state locks
- terraform -lock-timeout behavior
Explanation
Correct Answer
A:The task is to identify the precise stale lock before taking exceptional recovery action; Lock identifier verification directly supports that requirement: A lock ID should be matched to the blocked state operation before unlocking. Its relevant boundary is: Guessing an ID or acting during an active deployment can corrupt coordination.
Incorrect Answers
B:Remote backend locking capabilities is designed to select shared state storage with appropriate concurrency semantics, whereas this task is to identify the precise stale lock before taking exceptional recovery action: Supported remote backends can coordinate locking around updates to common state. Against Lock identifier verification, its limitation is: Remote storage and locking are related but distinct capabilities.
C:Terraform state locking is designed to prevent two concurrent runs from writing the same state snapshot, whereas this task is to identify the precise stale lock before taking exceptional recovery action: A backend with locking support serializes operations that could corrupt shared state. Against Lock identifier verification, its limitation is: Not every backend supports locking in the same way.
D:Avoid disabling state locks is designed to protect shared state rather than using -lock=false as a routine workaround, whereas this task is to identify the precise stale lock before taking exceptional recovery action: Using a lock-capable backend with normal locking reduces state races. Against Lock identifier verification, its limitation is: -lock=false makes concurrent writers potentially unsafe.
E: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 identify the precise stale lock before taking exceptional recovery action: The lock-timeout flag controls how long supported operations retry obtaining a lock. Against Lock identifier verification, its limitation is: It does not itself activate locking on a backend that lacks that feature.
Question 357
The deployment owner requests a reliable way to make some child module arguments optional for callers. Which mechanism most directly meets this particular need?
- Module local values
- Module outputs with repeated instances
- Module input defaults
- Child module input variable
Explanation
Correct Answer
C:The task is to make some child module arguments optional for callers; Module input defaults directly supports that requirement: A child variable with a default can be omitted by the caller, allowing the child to use its fallback. Its relevant boundary is: A default does not override an explicitly passed module argument.
Incorrect Answers
A:Module local values is designed to compute module-specific intermediate values without exporting them, whereas this task is to make some child module arguments optional for callers: Local values belong to the defining module and are referenced through local.name in that scope. Against Module input defaults, its limitation is: They are not automatically exposed through a module output reference.
B: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 make some child module arguments optional for callers: Counted module outputs use numeric indices; for_each module outputs use instance keys. Against Module input defaults, its limitation is: A repeated module call is not the same value shape as a single module output object.
D:Child module input variable addresses the different requirement 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; this does not by itself satisfy the requested task to make some child module arguments optional for callers. For the stated need, Module input defaults is the more direct mechanism.
Question 358
A deployment design calls for a supported way to avoid long-lived static cloud credentials in workspace variables. Which mechanism most directly meets this particular need?
- HCP Terraform dynamic provider credentials
- HCP Terraform teams and permissions
- HCP Terraform policy sets
- HCP Terraform private module registry
Explanation
Correct Answer
A:The task is to avoid long-lived static cloud credentials in workspace variables; HCP Terraform dynamic provider credentials directly supports that requirement: Supported dynamic credentials issue time-limited tokens to runs based on trust configuration. Its relevant boundary is: The target provider and cloud identity federation must be configured correctly.
Incorrect Answers
B:HCP Terraform teams and permissions is designed to grant workspace access based on collaboration responsibilities, whereas this task is to avoid long-lived static cloud credentials in workspace variables: Teams can be assigned appropriate workspace permissions for viewing, planning, and applying. Against HCP Terraform dynamic provider credentials, its limitation is: Team permission management requires a supported paid HCP Terraform edition; these roles do not replace cloud-provider permissions.
C:HCP Terraform policy sets is designed to enforce organizational rules during infrastructure runs, whereas this task is to avoid long-lived static cloud credentials in workspace variables: HCP Terraform can evaluate governance policies such as Sentinel or OPA as part of run controls. Against HCP Terraform dynamic provider credentials, its limitation is: Policies assess plans or configuration; they are not Terraform resource providers.
D:HCP Terraform private module registry is designed to share approved reusable modules within an organization, whereas this task is to avoid long-lived static cloud credentials in workspace variables: A private registry distributes versioned modules to organization workspaces and teams. Against HCP Terraform dynamic provider credentials, its limitation is: Publishing a module is different from executing a workspace run.
Question 359
A team reviews the use of Variable default value in Terraform 1.12. Which purpose matches its actual behavior?
- load multiple variable assignments from a chosen tfvars file
- expose a selected Terraform expression to the caller or CLI
- give a module input a fallback when callers omit it
- override environment or tfvars values with an explicit CLI variable flag
Explanation
Correct Answer
C:The practical result of Variable default value, used to give a module input a fallback when callers omit it, is: A variable default supplies a value without requiring each caller to pass that argument. A qualification for this effect is: Explicit callers can override the default with their own value.
Incorrect Answers
A:That outcome applies to Variable file input, intended to load multiple variable assignments from a chosen tfvars file, rather than the question's feature Variable default value: The -var-file flag passes root-module input values from a named variable definitions file. Unlike Variable file input, Variable default value is intended to give a module input a fallback when callers omit it, not to load multiple variable assignments from a chosen tfvars file.
B:That outcome applies to Output block, intended to expose a selected Terraform expression to the caller or CLI, rather than the question's feature Variable default value: An output block publishes a value from its module, such as an endpoint or resource identifier. Unlike Output block, Variable default value is intended to give a module input a fallback when callers omit it, not to expose a selected Terraform expression to the caller or CLI.
D:That outcome applies to Variable source precedence, intended to override environment or tfvars values with an explicit CLI variable flag, rather than the question's feature Variable default value: Direct -var and -var-file command-line assignments have precedence over automatically loaded values. Unlike Variable source precedence, Variable default value is intended to give a module input a fallback when callers omit it, not to override environment or tfvars values with an explicit CLI variable flag.
Question 360
In a reusable deployment, the primary objective is to recreate equivalent infrastructure patterns from one codebase. Which mechanism most directly meets this particular need?
- Self-documenting resource relationships
- Version-controlled configuration history
- Change impact preview
- Consistent development and production patterns
- Repeatable environment provisioning
Explanation
Correct Answer
E:The task is to recreate equivalent infrastructure patterns from one codebase; Repeatable environment provisioning directly supports that requirement: Parameterizing reusable Terraform modules can provision consistent environment patterns repeatedly. Its relevant boundary is: Differences in inputs and provider versions can still alter actual results.
Incorrect Answers
A:Self-documenting resource relationships is designed to make infrastructure dependencies understandable from code, whereas this task is to recreate equivalent infrastructure patterns from one codebase: Resource references and explicit dependencies can express how objects relate without relying on tribal knowledge. Against Repeatable environment provisioning, its limitation is: Provider behavior and implicit side effects still need relevant documentation.
B:Version-controlled configuration history is designed to trace why infrastructure definitions changed, whereas this task is to recreate equivalent infrastructure patterns from one codebase: Git commits and pull requests make configuration edits auditable before the next Terraform run. Against Repeatable environment provisioning, its limitation is: A Git diff tracks source files rather than proving the exact live infrastructure state.
C:Change impact preview is designed to identify likely creations, updates, and deletions before execution, whereas this task is to recreate equivalent infrastructure patterns from one codebase: Terraform planning exposes proposed operations for examination before they take effect. Against Repeatable environment provisioning, its limitation is: A plan may include unknown attributes that are resolved only during apply.
D:Consistent development and production patterns is designed to reduce configuration drift across environments using shared modules, whereas this task is to recreate equivalent infrastructure patterns from one codebase: Reusing modules with explicit inputs aligns infrastructure design while allowing intentional environment differences. Against Repeatable environment provisioning, its limitation is: Sharing a module does not force all environments to use identical values.