Question 390
Reviewers reject “State resource addresses” as a way to prevent staging changes from unintentionally sharing the production state mapping. Which actual behavior explains why the proposal is unsuitable?
- Distinct backends, workspaces or root configurations can isolate state, but the configuration must target the intended instance set.
- A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes.
- State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons.
- State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter.
Explanation
Correct Answer
C:State resource addresses is used when an operator needs to identify which remote object corresponds to a particular configuration resource. Consequently, this choice cannot meet the separate requirement to prevent staging changes from unintentionally sharing the production state mapping. The intended action would instead require Separate state per environment.
Incorrect Answers
A:That outcome belongs to Separate state per environment, the mechanism that can prevent staging changes from unintentionally sharing the production state mapping. The question concerns the engineer’s actual proposal, State resource addresses; it is directed at identify which remote object corresponds to a particular configuration resource, not that result.
B:This behavior belongs to State locking, which helps engineers prevent concurrent state writers from overwriting each other's updates rather than satisfying the separate requirement to prevent staging changes from unintentionally sharing the production state mapping. The attempted technique was State resource addresses; it would instead be used to identify which remote object corresponds to a particular configuration resource, not to produce the effect associated with State locking.
D:This behavior belongs to State access protection, which helps engineers treat a Terraform state file as potentially sensitive data rather than satisfying the separate requirement to prevent staging changes from unintentionally sharing the production state mapping. The attempted technique was State resource addresses; it would instead be used to identify which remote object corresponds to a particular configuration resource, not to produce the effect associated with State access protection.
Question 391
A change request asks an engineer to inspect predicted create, update and delete actions prior to making changes. Which choice best implements the requested behavior?
- Iterate after feedback
- Review a plan before apply
- Separate plan and apply privileges
- Initialize after checkout
Explanation
Correct Answer
B:The plan stage compares desired configuration with observed resource state and shows the proposed operations for review; this directly meets the requirement to inspect predicted create, update and delete actions prior to making changes. By comparison, initialize after checkout is intended to prepare a newly cloned root module for local Terraform operations, which is a different task from inspect predicted create, update and delete actions prior to making changes.
Incorrect Answers
A:A revised configuration must be planned again because a prior plan does not automatically incorporate later edits; this mechanism is useful when the job is to modify and re-plan after a change request is rejected, whereas the current scenario requires the engineer to inspect predicted create, update and delete actions prior to making changes. These operations have different effects in the stated Terraform workflow.
C:Teams can make planning a review step and reserve apply execution for an authorized operator or HCP Terraform run; this mechanism is useful when the job is to require approval before an infrastructure change executes, whereas the current scenario requires the engineer to inspect predicted create, update and delete actions prior to making changes. These operations have different effects in the stated Terraform workflow.
D:Running terraform init configures backend access, child modules and required providers before plans can run; this mechanism is useful when the job is to prepare a newly cloned root module for local Terraform operations, whereas the current scenario requires the engineer to inspect predicted create, update and delete actions prior to making changes. These operations have different effects in the stated Terraform workflow.
Question 392
During an infrastructure design review about how to ask the caller for a value when no default should be assumed, a maintainer asks what “A required input variable” does. Which description is accurate?
- The JSON output mode serializes output values and metadata for automation; it can expose sensitive values and must be protected.
- Local values are internal named expressions accessed using local.NAME; they are not module input parameters.
- Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state.
- A variable block without a default requires a provided value if Terraform cannot otherwise obtain one.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to ask the caller for a value when no default should be assumed, so it produces the behavior described. In contrast, terraform output -json serves a different goal: retrieve root outputs for integration with another program, not ask the caller for a value when no default should be assumed.
Incorrect Answers
A:The description applies to terraform output -json when an engineer needs to retrieve root outputs for integration with another program; the named a required input variable instead handles the requirement to ask the caller for a value when no default should be assumed, so this behavior does not describe A required input variable in the situation named.
B:The description applies to a locals block when an engineer needs to compute and reuse a derived expression without asking callers to supply it; the named a required input variable instead handles the requirement to ask the caller for a value when no default should be assumed, so this behavior does not describe A required input variable in the situation named.
C:The description applies to a sensitive output when an engineer needs to hide a secret-like output from Terraform's usual human-readable display; the named a required input variable instead handles the requirement to ask the caller for a value when no default should be assumed, so this behavior does not describe A required input variable in the situation named.
Question 393
A team compares Terraform mechanisms for the goal to replace one managed resource when another managed resource's attribute changes. Which stated consequence belongs specifically to “replace_triggered_by”?
- This lifecycle rule uses planned resource actions as triggers for replacement and is not a general-purpose dependency selector.
- An output block can express an explicit dependency beyond references contained in its value expression.
- The depends_on edge can relate the whole counted resource block to an upstream resource, rather than computing one edge by list position.
- Using the network object's ID in the subnet argument automatically creates a dependency edge in the graph.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to replace one managed resource when another managed resource's attribute changes, so it produces the behavior described. In contrast, an implicit dependency through an ID serves a different goal: make a subnet wait for the network resource it references, not replace one managed resource when another managed resource's attribute changes.
Incorrect Answers
B:The description applies to output-level depends_on when an engineer needs to prevent a module output from being considered ready before an additional side-effect resource; the named replace_triggered_by instead handles the requirement to replace one managed resource when another managed resource's attribute changes, so this behavior does not describe replace_triggered_by in the situation named.
C:The description applies to count and depends_on together when an engineer needs to make multiple resource instances wait for a shared prerequisite; the named replace_triggered_by instead handles the requirement to replace one managed resource when another managed resource's attribute changes, so this behavior does not describe replace_triggered_by in the situation named.
D:The description applies to an implicit dependency through an ID when an engineer needs to make a subnet wait for the network resource it references; the named replace_triggered_by instead handles the requirement to replace one managed resource when another managed resource's attribute changes, so this behavior does not describe replace_triggered_by in the situation named.
Question 394
A runbook lists “terraform plan -out” for the task to save an execution plan to a binary file for later application. Which technical effect should its description include?
- Disabling refresh reduces remote reads but can hide drift and produce an inaccurate plan based on stale observations.
- The -out option writes a saved plan so the reviewed actions can be supplied to terraform apply without recomputing from modified inputs.
- Plans show replacement when the provider cannot update a changed property in place; create-before-destroy can change the replacement order.
- Terraform graph nodes can run concurrently when no dependency edge requires a particular order.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to save an execution plan to a binary file for later application, so it produces the behavior described. In contrast, the dependency graph during planning serves a different goal: explain why two unrelated resources can be planned and applied in parallel, not save an execution plan to a binary file for later application.
Incorrect Answers
A:The description applies to terraform plan -refresh=false when an engineer needs to skip routine state refresh for a constrained preview; the named terraform plan -out instead handles the requirement to save an execution plan to a binary file for later application, so this behavior does not describe terraform plan -out in the situation named.
C: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 plan -out instead handles the requirement to save an execution plan to a binary file for later application, so this behavior does not describe terraform plan -out in the situation named.
D:The description applies to the dependency graph during planning when an engineer needs to explain why two unrelated resources can be planned and applied in parallel; the named terraform plan -out instead handles the requirement to save an execution plan to a binary file for later application, so this behavior does not describe terraform plan -out in the situation named.
Question 395
The team evaluates “A root output block” for a requirement to publish a computed result after applying a root module. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- Terraform reads variables named TF_VAR_name as a source of input assignments, subject to input precedence rules.
- An output block exposes an expression value to CLI users and supported automation or cross-configuration consumers.
- The -var-file flag explicitly selects a variables file rather than relying on auto-loaded naming conventions.
- Descriptions communicate intended values to users and tooling but do not change evaluation semantics or set defaults.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to publish a computed result after applying a root module, so it produces the behavior described. In contrast, a variable description serves a different goal: document what input callers should supply when using a module, not publish a computed result after applying a root module.
Incorrect Answers
A:The description applies to an environment variable prefixed TF_VAR_ when an engineer needs to provide root-module input values from an automated execution environment; the named a root output block instead handles the requirement to publish a computed result after applying a root module, so this behavior does not describe A root output block in the situation named.
C:The description applies to the -var-file option when an engineer needs to load a nonstandard variable file selected for one environment; the named a root output block instead handles the requirement to publish a computed result after applying a root module, so this behavior does not describe A root output block in the situation named.
D:The description applies to a variable description when an engineer needs to document what input callers should supply when using a module; the named a root output block instead handles the requirement to publish a computed result after applying a root module, so this behavior does not describe A root output block in the situation named.
Question 396
An engineer preparing an infrastructure rollout has a concrete implementation goal: identify which file should be checked in to preserve selected provider packages. What is the most appropriate Terraform mechanism?
- terraform init -reconfigure
- terraform init -migrate-state
- terraform init -backend-config
- The .terraform.lock.hcl file
Explanation
Correct Answer
D:Terraform records provider version and checksum selections in its dependency lock file, which teams normally commit to source control; this directly meets the requirement to identify which file should be checked in to preserve selected provider packages. By comparison, terraform init -migrate-state is intended to move existing state to a newly configured backend, which is a different task from identify which file should be checked in to preserve selected provider packages.
Incorrect Answers
A:Reconfigure tells init to treat the supplied backend configuration as new, rather than performing a state migration; this mechanism is useful when the job is to discard the previously cached backend connection without copying existing state, whereas the current scenario requires the engineer to identify which file should be checked in to preserve selected provider packages. These operations have different effects in the stated Terraform workflow.
B:The migrate-state flag attempts to copy prior state into the new backend and can prompt for migration confirmation; this mechanism is useful when the job is to move existing state to a newly configured backend, whereas the current scenario requires the engineer to identify which file should be checked in to preserve selected provider packages. These operations have different effects in the stated Terraform workflow.
C:This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets; this mechanism is useful when the job is to inject partial backend settings at initialization time, whereas the current scenario requires the engineer to identify which file should be checked in to preserve selected provider packages. These operations have different effects in the stated Terraform workflow.
Question 397
During a design review, the requirement is to execute the approved set of infrastructure changes. Which option should the engineer select?
- Apply reviewed configuration
- Review a plan before apply
- Iterate after feedback
- Write configuration first
- Initialize after checkout
- Check infrastructure after apply
Explanation
Correct Answer
A:terraform apply invokes providers to carry out selected planned operations and updates state with their results; this directly meets the requirement to execute the approved set of infrastructure changes. By comparison, check infrastructure after apply is intended to confirm deployed outputs and state match the expected result, which is a different task from execute the approved set of infrastructure changes.
Incorrect Answers
B:The plan stage compares desired configuration with observed resource state and shows the proposed operations for review; this mechanism is useful when the job is to inspect predicted create, update and delete actions prior to making changes, whereas the current scenario requires the engineer to execute the approved set of infrastructure changes. These operations have different effects in the stated Terraform workflow.
C:A revised configuration must be planned again because a prior plan does not automatically incorporate later edits; this concerns the task to modify and re-plan after a change request is rejected, not the current need to execute the approved set of infrastructure changes. A Apply reviewed configuration approach is appropriate here; the substituted Iterate after feedback option does not supply the specified Terraform capability.
D:The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage; this mechanism is useful when the job is to express the intended infrastructure before asking Terraform for a plan, whereas the current scenario requires the engineer to execute the approved set of infrastructure changes. These operations have different effects in the stated Terraform workflow.
E:Running terraform init configures backend access, child modules and required providers before plans can run; this mechanism is useful when the job is to prepare a newly cloned root module for local Terraform operations, whereas the current scenario requires the engineer to execute the approved set of infrastructure changes. These operations have different effects in the stated Terraform workflow.
F:Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift; this mechanism is useful when the job is to confirm deployed outputs and state match the expected result, whereas the current scenario requires the engineer to execute the approved set of infrastructure changes. These operations have different effects in the stated Terraform workflow.
Question 398
A new Terraform working directory has a concrete implementation goal: use the default provider configuration for a resource type. What is the most appropriate Terraform mechanism?
- Provider integrity hashes
- Provider data refresh
- Provider version compatibility
- Implicit provider selection
Explanation
Correct Answer
D:Terraform generally selects the default provider matching a resource's type prefix unless an alternate configuration is specified; this directly meets the requirement to use the default provider configuration for a resource type. By comparison, provider integrity hashes is intended to detect a mismatched plugin distribution package, which is a different task from use the default provider configuration for a resource type.
Incorrect Answers
A:Terraform checks downloaded provider package checksums against lock information where hashes are available; this mechanism is useful when the job is to detect a mismatched plugin distribution package, whereas the current scenario requires the engineer to use the default provider configuration for a resource type. These operations have different effects in the stated Terraform workflow.
B:Providers retrieve object details so Terraform can compare observed infrastructure against desired configuration and prior state; this mechanism is useful when the job is to read current attributes of managed remote objects during planning, whereas the current scenario requires the engineer to use the default provider configuration for a resource type. These operations have different effects in the stated Terraform workflow.
C:Version constraints and a shared lock file reduce unintended schema and behavior changes between deployments; this mechanism is useful when the job is to prevent incompatible provider upgrades from affecting resource handling, whereas the current scenario requires the engineer to use the default provider configuration for a resource type. These operations have different effects in the stated Terraform workflow.
Question 399
An output block uses the value expression contains(["x", "y"], "z"). Assuming only the literal data shown, which result should be expected?
- null
- "z"
- false
- true
Explanation
Correct Answer
C:The expression contains(["x", "y"], "z") evaluates to false because z is not equal to either member of the supplied two-element collection. This is Terraform's direct evaluation of the supplied literal arguments in contains(["x", "y"], "z"), not an external provider lookup.
Incorrect Answers
A:The collection and candidate are known, so this membership check evaluates to false. HCL evaluates contains(["x", "y"], "z") using the supplied arguments: z is not equal to either member of the supplied two-element collection; the listed result is therefore incorrect.
B:Contains returns a boolean rather than the requested item. In this specific evaluation, z is not equal to either member of the supplied two-element collection, which rules out the proposed alternative.
D:No member matches the searched z value. For contains(["x", "y"], "z"), z is not equal to either member of the supplied two-element collection; consequently this candidate is not the value Terraform computes.
Question 400
A Terraform deployment has independent requirements: (1) fail a plan or apply when a prerequisite property is unacceptable; (2) prevent unauthorized operators from reading sensitive resource attributes. Which TWO mechanisms directly address these needs? Choose TWO.
- Remote state access controls
- A write-only argument version field
- Resource postcondition
- Resource precondition
- No secrets in version control
- terraform validate versus runtime assertions
Explanation
Correct Answers
A:Protecting state requires backend encryption, identity-based authorization and controlled access because state can store raw secret values; this meets the requirement to prevent unauthorized operators from reading sensitive resource attributes, while the other selected techniques address fail a plan or apply when a prerequisite property is unacceptable, which require their own distinct Terraform mechanisms.
D:A precondition inside lifecycle requires a true predicate before Terraform can continue the relevant resource operation; this meets the requirement to fail a plan or apply when a prerequisite property is unacceptable, while the other selected techniques address prevent unauthorized operators from reading sensitive resource attributes, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:Some write-only provider arguments expose an accompanying nonsecret version marker that triggers a new operation when incremented; it addresses force an update when a write-only secret changes without exposing the secret itself, but this delivery instead requires fail a plan or apply when a prerequisite property is unacceptable and prevent unauthorized operators from reading sensitive resource attributes. The required combination involves Resource precondition and Remote state access controls, not the behavior of A write-only argument version field.
C:A postcondition evaluates a condition concerning resource results and blocks downstream use when its assertion fails; it addresses verify an invariant about a resource after reading or managing it, but this delivery instead requires fail a plan or apply when a prerequisite property is unacceptable and prevent unauthorized operators from reading sensitive resource attributes. The required combination involves Resource precondition and Remote state access controls, not the behavior of Resource postcondition.
E:Secrets inserted directly into tracked configuration can leak through repository history, regardless of later state redaction; it addresses keep API keys out of committed terraform.tfvars and .tf files, but this delivery instead requires fail a plan or apply when a prerequisite property is unacceptable and prevent unauthorized operators from reading sensitive resource attributes. The required combination involves Resource precondition and Remote state access controls, not the behavior of No secrets in version control.
F:Static validate checks structural correctness, while condition expressions may depend on inputs or provider readings evaluated during plan or apply; it addresses distinguish static configuration checks from conditions requiring actual resource values, but this delivery instead requires fail a plan or apply when a prerequisite property is unacceptable and prevent unauthorized operators from reading sensitive resource attributes. The required combination involves Resource precondition and Remote state access controls, not the behavior of terraform validate versus runtime assertions.