Question 280
An engineer intends to store Terraform state in a file in the working directory by default and is reviewing “The default local backend”. What consequence follows from using it as intended?
- Without another backend, Terraform uses the local backend and writes its default workspace state to terraform.tfstate.
- The local backend supports a path argument for where the state file is stored on disk.
- Changing the root backend and running init -migrate-state can transfer the existing snapshot to the newly configured destination.
- Local files do not provide an organization-wide shared state or distributed locking comparable to an appropriately configured remote backend.
- Local state can hold raw provider attributes and secrets, so filesystem access controls and encryption matter.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to store Terraform state in a file in the working directory by default, so it produces the behavior described. In contrast, state file confidentiality serves a different goal: protect a workstation's local state file even when output values are hidden, not store Terraform state in a file in the working directory by default.
Incorrect Answers
B:The description applies to a local backend path setting when an engineer needs to save the default workspace state to a nondefault local filename; the named the default local backend instead handles the requirement to store Terraform state in a file in the working directory by default, so this behavior does not describe The default local backend in the situation named.
C:The description applies to state migration from local storage when an engineer needs to move an established project to remote state without abandoning resource identity; the named the default local backend instead handles the requirement to store Terraform state in a file in the working directory by default, so this behavior does not describe The default local backend in the situation named.
D:The description applies to the local backend's lack of team collaboration features when an engineer needs to avoid concurrent writes from multiple operators on different machines; the named the default local backend instead handles the requirement to store Terraform state in a file in the working directory by default, so this behavior does not describe The default local backend in the situation named.
E:The description applies to state file confidentiality when an engineer needs to protect a workstation's local state file even when output values are hidden; the named the default local backend instead handles the requirement to store Terraform state in a file in the working directory by default, so this behavior does not describe The default local backend in the situation named.
Question 281
A change request asks an engineer to provide environment-specific backend details at initialization rather than hard-coding them. Which choice best implements the requested behavior?
- Init after changing state storage
- Backend state key separation
- Partial backend configuration
- Remote state encryption at rest
Explanation
Correct Answer
C:Backend config arguments supplied at init time fill required values, but sensitive content can still be cached in local metadata or plans; this directly meets the requirement to provide environment-specific backend details at initialization rather than hard-coding them. By comparison, init after changing state storage is intended to adopt a new remote state destination after editing configuration, which is a different task from provide environment-specific backend details at initialization rather than hard-coding them.
Incorrect Answers
A:Terraform detects changed backend settings and requires initialization with an explicit migration or reconfiguration choice; this mechanism is useful when the job is to adopt a new remote state destination after editing configuration, whereas the current scenario requires the engineer to provide environment-specific backend details at initialization rather than hard-coding them. These operations have different effects in the stated Terraform workflow.
B:Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot; this mechanism is useful when the job is to store different applications' state snapshots at distinct object paths, whereas the current scenario requires the engineer to provide environment-specific backend details at initialization rather than hard-coding them. These operations have different effects in the stated Terraform workflow.
D:Encryption is controlled by the chosen backend service; Terraform's remote backend abstraction does not supply one universal encryption mechanism; this mechanism is useful when the job is to protect stored state contents from unauthorized storage-layer access, whereas the current scenario requires the engineer to provide environment-specific backend details at initialization rather than hard-coding them. These operations have different effects in the stated Terraform workflow.
Question 282
A change request asks an engineer to reject use of queried data when it violates a required invariant. Which choice best implements the requested behavior?
- The error_message field
- Preconditions for external assumptions
- Resource precondition
- Data source postcondition
- Input variable validation
Explanation
Correct Answer
D:A postcondition on a data block can validate attributes returned from a provider before downstream resources rely on them; this directly meets the requirement to reject use of queried data when it violates a required invariant. By comparison, input variable validation is intended to reject malformed module inputs before provisioning resources, which is a different task from reject use of queried data when it violates a required invariant.
Incorrect Answers
A:Validation, precondition and postcondition definitions use error_message to tell the operator why a rule failed; this mechanism is useful when the job is to present a meaningful explanation when a custom condition evaluates false, whereas the current scenario requires the engineer to reject use of queried data when it violates a required invariant. These operations have different effects in the stated Terraform workflow.
B:A precondition can express a domain requirement such as a selected image having an expected property before using it; this mechanism is useful when the job is to guard a resource against prerequisites outside the provider's basic schema, whereas the current scenario requires the engineer to reject use of queried data when it violates a required invariant. These operations have different effects in the stated Terraform workflow.
C:A precondition inside lifecycle requires a true predicate before Terraform can continue the relevant resource operation; this mechanism is useful when the job is to fail a plan or apply when a prerequisite property is unacceptable, whereas the current scenario requires the engineer to reject use of queried data when it violates a required invariant. These operations have different effects in the stated Terraform workflow.
E:The validation block uses a condition and a custom error_message to enforce rules on caller-supplied values; this mechanism is useful when the job is to reject malformed module inputs before provisioning resources, whereas the current scenario requires the engineer to reject use of queried data when it violates a required invariant. These operations have different effects in the stated Terraform workflow.
Question 283
An engineer intends to display configuration and state dependencies for troubleshooting and is reviewing “terraform graph”. What consequence follows from using it as intended?
- Terraform may mark attributes as known after apply because a provider assigns their values only when creating or updating a real object.
- Plans show replacement when the provider cannot update a changed property in place; create-before-destroy can change the replacement order.
- Disabling refresh reduces remote reads but can hide drift and produce an inaccurate plan based on stale observations.
- The graph command emits a DOT graph representation of Terraform dependencies, useful for spotting unexpected ordering constraints.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to display configuration and state dependencies for troubleshooting, so it produces the behavior described. In contrast, terraform plan -refresh=false serves a different goal: skip routine state refresh for a constrained preview, not display configuration and state dependencies for troubleshooting.
Incorrect Answers
A:The description applies to an unknown value until apply when an engineer needs to understand why a computed attribute is unavailable in the preview; the named terraform graph instead handles the requirement to display configuration and state dependencies for troubleshooting, so this behavior does not describe terraform graph in the situation named.
B:The description applies to a replacement action in the plan when an engineer needs to recognize a destroy-and-create operation for an immutable argument; the named terraform graph instead handles the requirement to display configuration and state dependencies for troubleshooting, so this behavior does not describe terraform graph in the situation named.
C:The description applies to terraform plan -refresh=false when an engineer needs to skip routine state refresh for a constrained preview; the named terraform graph instead handles the requirement to display configuration and state dependencies for troubleshooting, so this behavior does not describe terraform graph in the situation named.
Question 284
A Terraform reviewer encounters “Separate plan and apply privileges” while assessing how to require approval before an infrastructure change executes. Which statement correctly describes its actual behavior?
- The plan stage compares desired configuration with observed resource state and shows the proposed operations for review.
- A revised configuration must be planned again because a prior plan does not automatically incorporate later edits.
- Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift.
- Running terraform init configures backend access, child modules and required providers before plans can run.
- Teams can make planning a review step and reserve apply execution for an authorized operator or HCP Terraform run.
Explanation
Correct Answer
E:The named mechanism is used when the objective is to require approval before an infrastructure change executes, so it produces the behavior described. In contrast, initialize after checkout serves a different goal: prepare a newly cloned root module for local Terraform operations, not require approval before an infrastructure change executes.
Incorrect Answers
A:The description applies to review a plan before apply when an engineer needs to inspect predicted create, update and delete actions prior to making changes; the named separate plan and apply privileges instead handles the requirement to require approval before an infrastructure change executes, so this behavior does not describe Separate plan and apply privileges in the situation named.
B:The description applies to iterate after feedback when an engineer needs to modify and re-plan after a change request is rejected; the named separate plan and apply privileges instead handles the requirement to require approval before an infrastructure change executes, so this behavior does not describe Separate plan and apply privileges in the situation named.
C:This describes Check infrastructure after apply and its job to confirm deployed outputs and state match the expected result, whereas the question asks about Separate plan and apply privileges. The latter is the mechanism used to require approval before an infrastructure change executes; the proposed effect belongs to a different Terraform feature.
D:The description applies to initialize after checkout when an engineer needs to prepare a newly cloned root module for local Terraform operations; the named separate plan and apply privileges instead handles the requirement to require approval before an infrastructure change executes, so this behavior does not describe Separate plan and apply privileges in the situation named.
Question 285
A Terraform reviewer encounters “The HCP private module registry” while assessing how to share approved modules with organization members without relying on public registry visibility. Which statement correctly describes its actual behavior?
- Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects.
- Private registry modules can be published, versioned and discovered by authorized HCP Terraform users.
- HCP Terraform approval workflow separates viewing a plan from the permission to proceed with an apply.
- Policy sets organize policy rules and their workspace or project applicability rather than modifying provider schemas directly.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to share approved modules with organization members without relying on public registry visibility, so it produces the behavior described. In contrast, policy sets serves a different goal: attach a shared governance policy collection to selected workspace scopes, not share approved modules with organization members without relying on public registry visibility.
Incorrect Answers
A:The description applies to organization variable sets when an engineer needs to supply shared environment or Terraform input values across several workspaces; the named the HCP private module registry instead handles the requirement to share approved modules with organization members without relying on public registry visibility, so this behavior does not describe The HCP private module registry in the situation named.
C:The description applies to workspace run approvals when an engineer needs to require an authorized person to approve a run before applying changes; the named the HCP private module registry instead handles the requirement to share approved modules with organization members without relying on public registry visibility, so this behavior does not describe The HCP private module registry in the situation named.
D:The description applies to policy sets when an engineer needs to attach a shared governance policy collection to selected workspace scopes; the named the HCP private module registry instead handles the requirement to share approved modules with organization members without relying on public registry visibility, so this behavior does not describe The HCP private module registry in the situation named.
Question 286
An organization integrating Terraform with source control needs to check proposed infrastructure against rules expressed in Open Policy Agent policies. Which feature or operation is the most direct match?
- Project-based permission boundaries
- Workspace audit history
- The HCP private module registry
- Workspace run approvals
- OPA policy enforcement
Explanation
Correct Answer
E:HCP Terraform supports OPA-based policy sets for automated governance on applicable runs; this directly meets the requirement to check proposed infrastructure against rules expressed in Open Policy Agent policies. By comparison, project-based permission boundaries is intended to delegate administration of grouped HCP Terraform workspaces, which is a different task from check proposed infrastructure against rules expressed in Open Policy Agent policies.
Incorrect Answers
A:Projects group workspaces and support scoped access management for organizational teams; this mechanism is useful when the job is to delegate administration of grouped HCP Terraform workspaces, whereas the current scenario requires the engineer to check proposed infrastructure against rules expressed in Open Policy Agent policies. These operations have different effects in the stated Terraform workflow.
B:Run history records plan and apply activity to support team review and change tracking; this mechanism is useful when the job is to review past runs and changes in a shared HCP organization, whereas the current scenario requires the engineer to check proposed infrastructure against rules expressed in Open Policy Agent policies. These operations have different effects in the stated Terraform workflow.
C:Private registry modules can be published, versioned and discovered by authorized HCP Terraform users; this mechanism is useful when the job is to share approved modules with organization members without relying on public registry visibility, whereas the current scenario requires the engineer to check proposed infrastructure against rules expressed in Open Policy Agent policies. These operations have different effects in the stated Terraform workflow.
D:HCP Terraform approval workflow separates viewing a plan from the permission to proceed with an apply; this mechanism is useful when the job is to require an authorized person to approve a run before applying changes, whereas the current scenario requires the engineer to check proposed infrastructure against rules expressed in Open Policy Agent policies. These operations have different effects in the stated Terraform workflow.
Question 287
A pipeline responsible for the Terraform workflow requires a way to discard the previously cached backend connection without copying existing state. Which Terraform approach most directly fulfills that request?
- Repeatable initialization
- Provider source change reinitialization
- The .terraform directory
- terraform init -reconfigure
Explanation
Correct Answer
D:Reconfigure tells init to treat the supplied backend configuration as new, rather than performing a state migration; this directly meets the requirement to discard the previously cached backend connection without copying existing state. By comparison, provider source change reinitialization is intended to respond after changing the source address of a required provider, which is a different task from discard the previously cached backend connection without copying existing state.
Incorrect Answers
A:terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup; this mechanism is useful when the job is to run initialization again in an already prepared directory without unnecessary changes, whereas the current scenario requires the engineer to discard the previously cached backend connection without copying existing state. These operations have different effects in the stated Terraform workflow.
B:A modified provider requirement can trigger a need to rerun init to resolve the newly declared plugin dependency; this mechanism is useful when the job is to respond after changing the source address of a required provider, whereas the current scenario requires the engineer to discard the previously cached backend connection without copying existing state. These operations have different effects in the stated Terraform workflow.
C:Terraform creates .terraform for module caches, provider installations and backend/workspace metadata; it is not a substitute for committed configuration; this mechanism is useful when the job is to identify where a working directory keeps installed modules and initialization metadata, whereas the current scenario requires the engineer to discard the previously cached backend connection without copying existing state. These operations have different effects in the stated Terraform workflow.
Question 288
A Terraform deployment has independent requirements: (1) prevent a child module from silently using an unpassed alternate provider configuration; (2) translate Terraform resource operations into calls to the relevant remote API. Which TWO mechanisms directly address these needs? Choose TWO.
- Provider-defined resource schemas
- No implicit child-module alias inheritance
- Provider aliases
- A provider plugin
- Provider configuration at the root
Explanation
Correct Answers
B:Non-default provider configurations must be passed explicitly to a child module instead of assuming aliases will propagate; this meets the requirement to prevent a child module from silently using an unpassed alternate provider configuration, while the other selected techniques address translate Terraform resource operations into calls to the relevant remote API, which require their own distinct Terraform mechanisms.
D:Providers implement resource and data-source schemas plus read, create, update and delete operations for their services; this meets the requirement to translate Terraform resource operations into calls to the relevant remote API, while the other selected techniques address prevent a child module from silently using an unpassed alternate provider configuration, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:The provider declares accepted resource arguments and computed attributes; Terraform validates configuration against that schema; it addresses determine which arguments a resource type accepts, but this delivery instead requires prevent a child module from silently using an unpassed alternate provider configuration and translate Terraform resource operations into calls to the relevant remote API. The required combination involves A provider plugin and No implicit child-module alias inheritance, not the behavior of Provider-defined resource schemas.
C:A provider configuration with alias defines a named alternate that resources or modules can explicitly select; it addresses configure two connections to the same service for different regions or accounts, but this delivery instead requires prevent a child module from silently using an unpassed alternate provider configuration and translate Terraform resource operations into calls to the relevant remote API. The required combination involves A provider plugin and No implicit child-module alias inheritance, not the behavior of Provider aliases.
E:Reusable child modules should primarily declare provider requirements and receive configurations from callers rather than embedding fixed credentials; it addresses supply provider configurations from the root module to reusable child modules, but this delivery instead requires prevent a child module from silently using an unpassed alternate provider configuration and translate Terraform resource operations into calls to the relevant remote API. The required combination involves A provider plugin and No implicit child-module alias inheritance, not the behavior of Provider configuration at the root.
Question 289
An engineer intends to reuse a provider whose source address differs from its short local identifier and is reviewing “Provider-local name mapping”. What consequence follows from using it as intended?
- The required_providers entry maps the chosen local name to a specific fully qualified provider source address.
- Declare an aliased provider configuration and assign provider = provider_name.alias on resources that need the alternate region.
- A data block can set provider = aws.secondary to query through an alternate provider configuration.
- Non-default provider configurations must be passed explicitly to a child module instead of assuming aliases will propagate.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to reuse a provider whose source address differs from its short local identifier, so it produces the behavior described. In contrast, an aliased provider instance serves a different goal: create resources in a second region using the same provider type, not reuse a provider whose source address differs from its short local identifier.
Incorrect Answers
B:The description applies to an aliased provider instance when an engineer needs to create resources in a second region using the same provider type; the named provider-local name mapping instead handles the requirement to reuse a provider whose source address differs from its short local identifier, so this behavior does not describe Provider-local name mapping in the situation named.
C:The description applies to explicit provider selection on data blocks when an engineer needs to read an object from a secondary account rather than the default account; the named provider-local name mapping instead handles the requirement to reuse a provider whose source address differs from its short local identifier, so this behavior does not describe Provider-local name mapping in the situation named.
D:The description applies to no implicit child-module alias inheritance when an engineer needs to prevent a child module from silently using an unpassed alternate provider configuration; the named provider-local name mapping instead handles the requirement to reuse a provider whose source address differs from its short local identifier, so this behavior does not describe Provider-local name mapping in the situation named.
Question 290
A team compares Terraform mechanisms for the goal to connect a root configuration to an HCP Terraform organization and workspace. Which stated consequence belongs specifically to “A cloud block in terraform settings”?
- The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate.
- Terraform does not allow simultaneous cloud and backend blocks because both would compete to control the state and execution connection.
- A terraform cloud block declares organization and workspace selection, integrating the local CLI with HCP Terraform workflows.
- Dynamic credentials integrate HCP Terraform with supported identity federation to obtain scoped run credentials.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to connect a root configuration to an HCP Terraform organization and workspace, so it produces the behavior described. In contrast, mutual exclusivity of cloud and backend serves a different goal: avoid declaring both HCP cloud integration and a standard backend in the same root module, not connect a root configuration to an HCP Terraform organization and workspace.
Incorrect Answers
A:The description applies to terraform login when an engineer needs to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname; the named a cloud block in terraform settings instead handles the requirement to connect a root configuration to an HCP Terraform organization and workspace, so this behavior does not describe A cloud block in terraform settings in the situation named.
B:The description applies to mutual exclusivity of cloud and backend when an engineer needs to avoid declaring both HCP cloud integration and a standard backend in the same root module; the named a cloud block in terraform settings instead handles the requirement to connect a root configuration to an HCP Terraform organization and workspace, so this behavior does not describe A cloud block in terraform settings in the situation named.
D:The description applies to dynamic provider credential integration when an engineer needs to grant HCP runs temporary cloud authorization instead of long-lived static secrets; the named a cloud block in terraform settings instead handles the requirement to connect a root configuration to an HCP Terraform organization and workspace, so this behavior does not describe A cloud block in terraform settings in the situation named.