Question 250
An operator is preparing a controlled Terraform change. Two independent changes are requested: first, propose state reconciliation for external changes without correcting real resources; second, interpret an attribute whose value is not available during planning. Which pair of measures fulfills both?
- Read
-/+ as replacement intent + Understand a (known after apply) value
- Use
terraform plan -replace=ADDRESS + Use terraform plan -refresh=false carefully
- Use
terraform plan -detailed-exitcode + Understand a (known after apply) value
- Use
terraform plan -refresh-only + Use terraform show -json tfplan
- Use
terraform plan -refresh-only + Understand a (known after apply) value
Explanation
Correct Answer
E:For the first criterion, refresh-only mode updates Terraform's view to remote reality when applied; it does not make cloud objects conform to the old configuration; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning; this directly addresses the need to propose state reconciliation for external changes without correcting real resources. For the separate second criterion, computed provider attributes may be unknown until resource creation; terraform carries unknown values through dependent expressions rather than fabricating them; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning; this fulfills the need to interpret an attribute whose value is not available during planning. Together they cover the independent tasks of propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the interpret an attribute whose value is not available during planning requirement, but the first is designed for another concern: Some argument changes cannot be updated remotely and require a new object; replacement can have downtime implications unless ordering or architecture mitigates it; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. That first component is designed to recognize a planned destroy-and-create operation rather than an in-place edit, which does not accomplish the requested task to propose state reconciliation for external changes without correcting real resources, even though the other measure satisfies interpret an attribute whose value is not available during planning.
B:The first measure is intended to request replacement of a particular managed instance: The flag adds a replacement instruction to planning for an addressed resource; it is preferable to legacy manual taint workflows for deliberate replacement; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. The second measure is intended to omit the usual state refresh while creating an ordinary plan: Skipping remote refresh can produce an inaccurate plan when out-of-band changes have occurred; it is not a drift-detection strategy; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. Neither is the directly designated method for the separate goals of propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning in this review.
C:The second measure does meet the interpret an attribute whose value is not available during planning requirement, but the first is designed for another concern: The option uses exit code 0 for no differences, 2 for differences, and 1 for errors; a nonzero value is not always an execution failure; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. That first component is designed to distinguish clean plans from plans with proposed changes in CI, which does not accomplish the requested task to propose state reconciliation for external changes without correcting real resources, even though the other measure satisfies interpret an attribute whose value is not available during planning.
D:The first measure meets the requirement to propose state reconciliation for external changes without correcting real resources, but its partner serves a different role: JSON output exposes structured planned values and actions; the output can contain sensitive values even when terminal formatting hides them; this behavior should be assessed against the concrete need to propose state reconciliation for external changes without correcting real resources and interpret an attribute whose value is not available during planning. That second component is designed to export machine-readable plan details for a policy tool, so the still-missing criterion is to interpret an attribute whose value is not available during planning, while the first criterion remains propose state reconciliation for external changes without correcting real resources.
Question 251
A CI pipeline must archive reviewable execution decisions. A reviewer must determine how to load an explicit environment input file. Which action is the appropriate choice?
- Use
terraform plan -refresh=false carefully
- Use
terraform plan -replace=ADDRESS
- Use
terraform plan -refresh-only
- Use
terraform plan -var-file=env.tfvars
- Use
terraform show -json tfplan
Explanation
Correct Answer
D:An explicitly selected tfvars file feeds input values into that run; a .tfvars file is not a provider dependency lock; this behavior should be assessed against the concrete need to load an explicit environment input file. This directly supports the task to load an explicit environment input file during a staged rollout.
Incorrect Answers
A:Skipping remote refresh can produce an inaccurate plan when out-of-band changes have occurred; it is not a drift-detection strategy; this behavior should be assessed against the concrete need to load an explicit environment input file. It may support a related workflow, but the question specifically requires the mechanism for load an explicit environment input file rather than omit the usual state refresh while creating an ordinary plan.
B:The flag adds a replacement instruction to planning for an addressed resource; it is preferable to legacy manual taint workflows for deliberate replacement; this behavior should be assessed against the concrete need to load an explicit environment input file. The stated requirement is to load an explicit environment input file, not to request replacement of a particular managed instance; this alternative addresses a different control or phase.
C:Refresh-only mode updates Terraform's view to remote reality when applied; it does not make cloud objects conform to the old configuration; this behavior should be assessed against the concrete need to load an explicit environment input file. That can be useful when the aim is to propose state reconciliation for external changes without correcting real resources, but it does not directly deliver the requested ability to load an explicit environment input file.
E:JSON output exposes structured planned values and actions; the output can contain sensitive values even when terminal formatting hides them; this behavior should be assessed against the concrete need to load an explicit environment input file. It may support a related workflow, but the question specifically requires the mechanism for load an explicit environment input file rather than export machine-readable plan details for a policy tool.
Question 252
The immediate Terraform task is to save a plan for later explicit approval and application. Which method handles that task most directly?
- Use
terraform plan -var='name=value'
- Use
terraform plan -out=tfplan
- Use
terraform show tfplan
- Run
terraform plan without applying
Explanation
Correct Answer
B:A saved plan captures selections and inputs for later use; it may include secrets and backend settings, so the artifact requires access controls; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application. This directly supports the task to save a plan for later explicit approval and application during a configuration change.
Incorrect Answers
A:CLI variable arguments supply run-specific values; they do not permanently modify the variable declaration or backend configuration; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application. The stated requirement is to save a plan for later explicit approval and application, not to override an input variable for one planned run; this alternative addresses a different control or phase.
C:Show decodes the saved plan for review; it does not run the provider operations represented by the plan; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application. The distinction matters here: using that mechanism to render a saved execution plan in readable form would still leave the objective to save a plan for later explicit approval and application unmet.
D:Plan evaluates dependencies and current state and reports create/update/replace/delete intentions; it normally performs no desired resource changes; this behavior should be assessed against the concrete need to save a plan for later explicit approval and application. It may support a related workflow, but the question specifically requires the mechanism for save a plan for later explicit approval and application rather than preview the actions needed to reconcile the declared configuration.
Question 253
A review finds confusion about resource versus data source behavior. The team must both adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object. Which paired choice implements those distinct goals?
- Reference
aws_instance.web.id for a managed resource + Distinguish locals from remote resource declarations
- Use a resource block together with an
import block + Declare a managed object with resource
- Use a resource block together with an
import block + Distinguish locals from remote resource declarations
- Query an existing object with
data + Distinguish locals from remote resource declarations
- Use a resource block together with an
import block + Reference data.aws_ami.base.id for a lookup
- Keep a data lookup separate from a same-object managed declaration + Use provider selection on both resource and data blocks
Explanation
Correct Answer
C:For the first criterion, import associates the provider's existing remote object with a declared resource address; simply reading it as a data source does not establish that lifecycle ownership; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object; this directly addresses the need to adopt a previously existing object into Terraform management. For the separate second criterion, local values are named expressions evaluated inside a module; they neither invoke resource creation nor bind a remote object into state; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object; this fulfills the need to compute reusable expression results without creating an API object. Together they cover the independent tasks of adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the compute reusable expression results without creating an API object requirement, but the first is designed for another concern: A managed resource reference omits the data. prefix; terraform derives a dependency when an argument uses its computed attributes; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object. That first component is designed to consume the ID of an object declared through a resource block, which does not accomplish the requested task to adopt a previously existing object into Terraform management, even though the other measure satisfies compute reusable expression results without creating an API object.
B:The first measure meets the requirement to adopt a previously existing object into Terraform management, but its partner serves a different role: A resource block is part of the desired managed infrastructure; terraform tracks its remote identity in state and may create, update, replace, or destroy it; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object. That second component is designed to ask Terraform to own the lifecycle of a remote object, so the still-missing criterion is to compute reusable expression results without creating an API object, while the first criterion remains adopt a previously existing object into Terraform management.
D:The second measure does meet the compute reusable expression results without creating an API object requirement, but the first is designed for another concern: Data sources ask providers to fetch properties; they do not make Terraform responsible for deleting or updating the queried object; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object. That first component is designed to read an object without asking Terraform to create or manage it, which does not accomplish the requested task to adopt a previously existing object into Terraform management, even though the other measure satisfies compute reusable expression results without creating an API object.
E:The first measure meets the requirement to adopt a previously existing object into Terraform management, but its partner serves a different role: The data. address prefix distinguishes a read-only lookup from a managed resource address; its value can feed managed resources without importing the looked-up object; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object. That second component is designed to use an attribute returned by a provider data source, so the still-missing criterion is to compute reusable expression results without creating an API object, while the first criterion remains adopt a previously existing object into Terraform management.
F:The first measure is intended to avoid mistaking two views of one API object for independent resources: A data source can read attributes but does not change who owns the underlying object; managing and reading one object need careful dependency design to avoid deferred or inconsistent reads; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object. The second measure is intended to direct API operations and lookups to the intended account or region: Provider aliases control where the relevant API call is sent; a data source without an explicit alias may query the default context even when a nearby resource uses an alternate one; this behavior should be assessed against the concrete need to adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object. Neither is the directly designated method for the separate goals of adopt a previously existing object into Terraform management and compute reusable expression results without creating an API object in this review.
Question 254
A configuration connects network and compute resources. Two independent changes are requested: first, identify the zero-based index of the current instance; second, collect an attribute from a list-like collection of resource instances. Which pair of measures fulfills both?
- Use
each.key in for_each blocks + Use resource.items[*].id for counted instances
- Use a
for expression over a resource map + Use output to expose child internals intentionally
- Use
count.index inside counted blocks + Use module.network.subnet_id
- Use
count.index inside counted blocks + Use resource.items[*].id for counted instances
Explanation
Correct Answer
D:For the first criterion, a count meta-argument creates numerically indexed instances. count.index is available in blocks that use count, not as a global value; this behavior should be assessed against the concrete need to identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances; this directly addresses the need to identify the zero-based index of the current instance. For the separate second criterion, splat expressions iterate list, set, or tuple values, including count-created instances. for_each maps are normally traversed using a for expression; this behavior should be assessed against the concrete need to identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances; this fulfills the need to collect an attribute from a list-like collection of resource instances. Together they cover the independent tasks of identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the collect an attribute from a list-like collection of resource instances requirement, but the first is designed for another concern: Keys form instance addresses such as resource.name["blue"]; the key is not the same as a numeric count.index; this behavior should be assessed against the concrete need to identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances. That first component is designed to identify the stable key of the current map or set instance, which does not accomplish the requested task to identify the zero-based index of the current instance, even though the other measure satisfies collect an attribute from a list-like collection of resource instances.
B:The first measure is intended to extract values from instances created with for_each: A map-oriented expression can iterate keys and values to build a list or map; a legacy list-style splat is not the right accessor for a for_each resource map; this behavior should be assessed against the concrete need to identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances. The second measure is intended to create a stable boundary for modules that callers depend on: An output value makes selected internal attributes available as module.name.output; child resources themselves remain encapsulated behind the module boundary; this behavior should be assessed against the concrete need to identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances. Neither is the directly designated method for the separate goals of identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances in this review.
C:The first measure meets the requirement to identify the zero-based index of the current instance, but its partner serves a different role: A caller sees child-module outputs rather than arbitrary internal resources; the output also communicates dependencies and can serve as an interface contract; this behavior should be assessed against the concrete need to identify the zero-based index of the current instance and collect an attribute from a list-like collection of resource instances. That second component is designed to consume a value explicitly exposed by a child module, so the still-missing criterion is to collect an attribute from a list-like collection of resource instances, while the first criterion remains identify the zero-based index of the current instance.
Question 255
A CI job injects environment-dependent values. A reviewer must determine how to prevent a temporary secret from being persisted to state and plan files. Which action is the appropriate choice?
- Mark an input variable
ephemeral = true
- Use
terraform output -raw NAME for a string result
- Define
output for a root result
- Set
default for an optional configuration input
Explanation
Correct Answer
A:Ephemeral inputs have restricted reference contexts such as provider blocks and write-only arguments; sensitivity by itself does not provide the same omission guarantee; this behavior should be assessed against the concrete need to prevent a temporary secret from being persisted to state and plan files. This directly supports the task to prevent a temporary secret from being persisted to state and plan files during a cross-team handoff.
Incorrect Answers
B:Raw output formats a supported string, number, or Boolean directly without extra Terraform representation; complex objects require another output format; this behavior should be assessed against the concrete need to prevent a temporary secret from being persisted to state and plan files. That can be useful when the aim is to retrieve a plain scalar output for shell integration, but it does not directly deliver the requested ability to prevent a temporary secret from being persisted to state and plan files.
C:Outputs provide a documented interface for command output and automation; they can be inspected with terraform output when recorded in state; this behavior should be assessed against the concrete need to prevent a temporary secret from being persisted to state and plan files. The distinction matters here: using that mechanism to expose a selected computed value after provisioning would still leave the objective to prevent a temporary secret from being persisted to state and plan files unmet.
D:A default provides a value without per-run input; a caller can still override it using a supported variable assignment mechanism; this behavior should be assessed against the concrete need to prevent a temporary secret from being persisted to state and plan files. It may support a related workflow, but the question specifically requires the mechanism for prevent a temporary secret from being persisted to state and plan files rather than supply a fallback when the caller omits the variable.
Question 256
A reviewer has to approve a two-part design: preserve a sequence in which position and duplicates may matter; additionally, look up values by arbitrary string keys. Which option pairs the correct mechanisms?
- Use
list(string) for ordered strings + Convert values with toset(...)
- Recognize map iteration's key ordering + Use
object({ name = string, enabled = bool })
- Use
list(string) for ordered strings + Use map(string) for named string values
- Use
flatten(...) for nested lists + Use map(string) for named string values
Explanation
Correct Answer
C:For the first criterion, lists have elements of one element type and maintain order; they are appropriate when resource arguments expect an ordered collection; this behavior should be assessed against the concrete need to preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys; this directly addresses the need to preserve a sequence in which position and duplicates may matter. For the separate second criterion, maps provide a homogeneous value type and stable keys; they differ from lists, which are indexed by position; this behavior should be assessed against the concrete need to preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys; this fulfills the need to look up values by arbitrary string keys. Together they cover the independent tasks of preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure meets the requirement to preserve a sequence in which position and duplicates may matter, but its partner serves a different role: Conversion is useful for stable for_each string keys; it is not equivalent to preserving the original list order; this behavior should be assessed against the concrete need to preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys. That second component is designed to remove duplicates and produce set semantics for iteration, so the still-missing criterion is to look up values by arbitrary string keys, while the first criterion remains preserve a sequence in which position and duplicates may matter.
B:The first measure is intended to avoid interpreting maps as insertion-ordered sequences: When Terraform converts map elements into an ordered result, it sorts keys lexically; this differs from an explicitly ordered input list; this behavior should be assessed against the concrete need to preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys. The second measure is intended to specify a named record with different attribute types: An object defines an exact attribute schema rather than a homogeneous map; terraform checks and may convert compatible input shapes to that contract; this behavior should be assessed against the concrete need to preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys. Neither is the directly designated method for the separate goals of preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys in this review.
D:The second measure does meet the look up values by arbitrary string keys requirement, but the first is designed for another concern: Flatten recursively reduces nested list/tuple containers while preserving the flattened order; it does not merge map attributes; this behavior should be assessed against the concrete need to preserve a sequence in which position and duplicates may matter and look up values by arbitrary string keys. That first component is designed to collapse a list of lists into one sequence, which does not accomplish the requested task to preserve a sequence in which position and duplicates may matter, even though the other measure satisfies look up values by arbitrary string keys.
Question 257
In a planned migration, the requested result is to measure the number of elements or characters in a value. What should the engineer select?
- Use
jsonencode(value)
- Use
contains(collection, value)
- Use
length(value) for a collection or string
- Use
concat(list1, list2)
Explanation
Correct Answer
C:Length works with strings and collections; it does not estimate provisioned resource counts when values are unknown; this behavior should be assessed against the concrete need to measure the number of elements or characters in a value. This directly supports the task to measure the number of elements or characters in a value during a deployment checklist.
Incorrect Answers
A:JSON encoding handles escaping and structured representations; hand-built string interpolation is more error-prone for nested JSON; this behavior should be assessed against the concrete need to measure the number of elements or characters in a value. The distinction matters here: using that mechanism to serialize a Terraform value into JSON text for an API argument would still leave the objective to measure the number of elements or characters in a value unmet.
B:Contains returns a Boolean membership result; it does not check whether an object has a named attribute with a separate schema; this behavior should be assessed against the concrete need to measure the number of elements or characters in a value. It may support a related workflow, but the question specifically requires the mechanism for measure the number of elements or characters in a value rather than test whether a collection includes a particular element.
D:Concat combines lists or tuples into one sequence; it does not remove duplicates as a set conversion would; this behavior should be assessed against the concrete need to measure the number of elements or characters in a value. That can be useful when the aim is to append sequences while retaining element order, but it does not directly deliver the requested ability to measure the number of elements or characters in a value.
Question 258
An engineer is diagnosing unexpected resource ordering. The team must both request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning. Which paired choice implements those distinct goals?
- Use
create_before_destroy = true + Use ignore_changes = [tags]
- Avoid a circular dependency graph + Use
prevent_destroy = true on a configured resource
- Use
replace_triggered_by for resource change coupling + Use ignore_changes = [tags]
- Use
create_before_destroy = true + Use terraform_data for value-driven replacement triggers
Explanation
Correct Answer
A:For the first criterion, this lifecycle rule can reduce service interruption where unique names and quotas allow coexistence; it cannot guarantee an API permits two simultaneous objects; this behavior should be assessed against the concrete need to request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning; this directly addresses the need to request creation of a replacement before deleting the old instance. For the separate second criterion, ignore-changes permits another process to adjust specified fields without Terraform constantly reverting them; it does not ignore creation-time arguments; this behavior should be assessed against the concrete need to request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning; this fulfills the need to exclude selected post-creation attribute differences from update planning. Together they cover the independent tasks of request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning without exchanging the responsibilities of these features.
Incorrect Answers
B:The first measure is intended to break mutual dependencies that prevent Terraform from ordering operations: Terraform cannot schedule a true cycle in its directed acyclic graph; rearranging references or splitting resource responsibilities can remove the cycle; this behavior should be assessed against the concrete need to request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning. The second measure is intended to fail a plan that would destroy the protected resource while its block remains: This is a lifecycle safety check, not a remote deletion-protection feature; removing the resource block also removes the rule from consideration; this behavior should be assessed against the concrete need to request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning. Neither is the directly designated method for the separate goals of request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning in this review.
C:The second measure does meet the exclude selected post-creation attribute differences from update planning requirement, but the first is designed for another concern: The rule ties replacement to planned actions on managed resources; plain local values do not themselves have planned resource actions; this behavior should be assessed against the concrete need to request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning. That first component is designed to replace a resource when another managed resource or attribute changes, which does not accomplish the requested task to request creation of a replacement before deleting the old instance, even though the other measure satisfies exclude selected post-creation attribute differences from update planning.
D:The first measure meets the requirement to request creation of a replacement before deleting the old instance, but its partner serves a different role: A terraform_data resource can turn a changing value into a planned change that replace_triggered_by can reference; this avoids trying to reference a bare variable as a resource action; this behavior should be assessed against the concrete need to request creation of a replacement before deleting the old instance and exclude selected post-creation attribute differences from update planning. That second component is designed to represent an input change through a managed resource lifecycle, so the still-missing criterion is to exclude selected post-creation attribute differences from update planning, while the first criterion remains request creation of a replacement before deleting the old instance.
Question 259
An operator is choosing between variable validation and ongoing health checks. Two independent changes are requested: first, verify an assumption before Terraform processes the target resource operation; second, ensure a module only exposes results that satisfy a contract. Which pair of measures fulfills both?
- Use a resource
precondition + Use an output precondition
- Use variable validation for valid network prefixes + Use
error_message for actionable custom diagnostics
- Use a resource
precondition + Use a postcondition for a provider-computed result
- Use
alltrue over transformed entries + Use an output precondition
Explanation
Correct Answer
A:For the first criterion, a lifecycle precondition can inspect values needed for a safe operation; failure blocks proceeding instead of simply recording a health warning; this behavior should be assessed against the concrete need to verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract; this directly addresses the need to verify an assumption before Terraform processes the target resource operation. For the separate second criterion, output preconditions can check values or dependencies before the output is finalized; they keep exported data subject to explicit guarantees; this behavior should be assessed against the concrete need to verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract; this fulfills the need to ensure a module only exposes results that satisfy a contract. Together they cover the independent tasks of verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract without exchanging the responsibilities of these features.
Incorrect Answers
B:The first measure is intended to reject malformed or disallowed input before resource creation: Functions like can(cidrhost(...)) can validate address-format assumptions; this is input correctness, distinct from connectivity tests of a deployed network; this behavior should be assessed against the concrete need to verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract. The second measure is intended to tell users which contract failed and why: Variable validation and lifecycle conditions support custom messages; a vague error message makes troubleshooting harder even when the Boolean test is correct; this behavior should be assessed against the concrete need to verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract. Neither is the directly designated method for the separate goals of verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract in this review.
C:The first measure meets the requirement to verify an assumption before Terraform processes the target resource operation, but its partner serves a different role: A computed attribute might be unknown during planning; postconditions evaluate when sufficient data exists, rather than fabricating a preliminary value; this behavior should be assessed against the concrete need to verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract. That second component is designed to test a guarantee only after the remote result is known, so the still-missing criterion is to ensure a module only exposes results that satisfy a contract, while the first criterion remains verify an assumption before Terraform processes the target resource operation.
D:The second measure does meet the ensure a module only exposes results that satisfy a contract requirement, but the first is designed for another concern: Combining a for expression with alltrue yields a single Boolean input contract; it is not the same as testing only the first list element; this behavior should be assessed against the concrete need to verify an assumption before Terraform processes the target resource operation and ensure a module only exposes results that satisfy a contract. That first component is designed to validate every element of a collection against one rule, which does not accomplish the requested task to verify an assumption before Terraform processes the target resource operation, even though the other measure satisfies ensure a module only exposes results that satisfy a contract.
Question 260
An infrastructure repository handles database passwords and tokens. A reviewer must determine how to preserve Terraform's safety indicator for secret-bearing expressions. Which action is the appropriate choice?
- Use a provider-supported write-only argument
- Treat saved plan files as sensitive artifacts
- Distinguish
ephemeral from sensitive
- Avoid unnecessary
nonsensitive(...) calls
Explanation
Correct Answer
D:Nonsensitive removes the sensitivity mark from a value; it does not erase the underlying secret and can expose it in outputs or logs; this behavior should be assessed against the concrete need to preserve Terraform's safety indicator for secret-bearing expressions. This directly supports the task to preserve Terraform's safety indicator for secret-bearing expressions during a staged rollout.
Incorrect Answers
A:Write-only arguments exist only where the provider schema supports them; they are available in Terraform 1.11+, including the tested 1.12 release; this behavior should be assessed against the concrete need to preserve Terraform's safety indicator for secret-bearing expressions. It may support a related workflow, but the question specifically requires the mechanism for preserve Terraform's safety indicator for secret-bearing expressions rather than send a secret to a managed resource without storing its value in plan or state.
B:Binary plans can preserve configuration values and secrets; redaction in human-readable output does not make the saved plan safe to publish; this behavior should be assessed against the concrete need to preserve Terraform's safety indicator for secret-bearing expressions. The stated requirement is to preserve Terraform's safety indicator for secret-bearing expressions, not to avoid leaking inputs and backend information through CI downloads; this alternative addresses a different control or phase.
C:Sensitive marks affect presentation; ephemeral marks constrain persistence and permitted expression contexts; they solve related but nonidentical problems; this behavior should be assessed against the concrete need to preserve Terraform's safety indicator for secret-bearing expressions. That can be useful when the aim is to choose secrecy controls based on persistence as well as output redaction, but it does not directly deliver the requested ability to preserve Terraform's safety indicator for secret-bearing expressions.