Question 290
A Terraform review separates 3 requirements: (1) replace a resource when another managed resource or attribute changes; (2) fail a plan that would destroy the protected resource while its block remains; (3) delay all operations in a child module until required prerequisites complete. Identify the three features that each directly handle one of those requirements. Choose THREE.
- Understand destroy order as dependency-aware
- Recognize propagated
create_before_destroy behavior
- Use
prevent_destroy = true on a configured resource
- Use
replace_triggered_by for resource change coupling
- Use an attribute reference for an implicit edge
- Use explicit dependencies on module calls carefully
Explanation
Correct Answers
C: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 replace a resource when another managed resource or attribute changes and fail a plan that would destroy the protected resource while its block remains and delay all operations in a child module until required prerequisites complete. This matches the distinct objective to fail a plan that would destroy the protected resource while its block remains; the remaining chosen features address replace a resource when another managed resource or attribute changes and delay all operations in a child module until required prerequisites complete.
D: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 replace a resource when another managed resource or attribute changes and fail a plan that would destroy the protected resource while its block remains and delay all operations in a child module until required prerequisites complete. This matches the distinct objective to replace a resource when another managed resource or attribute changes; the remaining chosen features address fail a plan that would destroy the protected resource while its block remains and delay all operations in a child module until required prerequisites complete.
F:depends_on on a module applies to the module's relevant actions, not just one output; it may be broader than a targeted output reference; this behavior should be assessed against the concrete need to replace a resource when another managed resource or attribute changes and fail a plan that would destroy the protected resource while its block remains and delay all operations in a child module until required prerequisites complete. This matches the distinct objective to delay all operations in a child module until required prerequisites complete; the remaining chosen features address replace a resource when another managed resource or attribute changes and fail a plan that would destroy the protected resource while its block remains.
Incorrect Answers
A:Terraform generally reverses dependency order for teardown; this minimizes failures caused by destroying prerequisites too early; this behavior should be assessed against the concrete need to replace a resource when another managed resource or attribute changes and fail a plan that would destroy the protected resource while its block remains and delay all operations in a child module until required prerequisites complete. Its main application is to remove dependents before the infrastructure they rely on; the checklist instead asks for replace a resource when another managed resource or attribute changes; and fail a plan that would destroy the protected resource while its block remains; and delay all operations in a child module until required prerequisites complete. None of those distinct criteria specifically calls for this alternative.
B:Terraform may propagate create-before-destroy to dependencies and preserve that decision in state; a downstream replacement can therefore affect upstream lifecycle ordering; this behavior should be assessed against the concrete need to replace a resource when another managed resource or attribute changes and fail a plan that would destroy the protected resource while its block remains and delay all operations in a child module until required prerequisites complete. Its main application is to understand why a dependency may also be retained during a replacement; the checklist instead asks for replace a resource when another managed resource or attribute changes; and fail a plan that would destroy the protected resource while its block remains; and delay all operations in a child module until required prerequisites complete. None of those distinct criteria specifically calls for this alternative.
E:Terraform builds a dependency from the expression reference; a separate explicit ordering rule is unnecessary when data flow already expresses the relationship; this behavior should be assessed against the concrete need to replace a resource when another managed resource or attribute changes and fail a plan that would destroy the protected resource while its block remains and delay all operations in a child module until required prerequisites complete. Its main application is to order resources when the second consumes a value from the first; the checklist instead asks for replace a resource when another managed resource or attribute changes; and fail a plan that would destroy the protected resource while its block remains; and delay all operations in a child module until required prerequisites complete. None of those distinct criteria specifically calls for this alternative.
Question 291
A module needs configuration guardrails. The team must both monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule. Which paired choice implements those distinct goals?
- Use a resource
postcondition + Use an output precondition
- Use
try for optional nested values + Use alltrue over transformed entries
- Use a
check block with assertions + Use alltrue over transformed entries
- Use a
check block with assertions + Use assert { condition = ... } inside check
Explanation
Correct Answer
C:For the first criterion, checks are designed for nonblocking validation and can report warnings during plan/apply; critical prerequisites belong in blocking custom conditions; this behavior should be assessed against the concrete need to monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule; this directly addresses the need to monitor an infrastructure invariant and report failed checks without blocking the whole operation. For the separate second criterion, 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 monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule; this fulfills the need to validate every element of a collection against one rule. Together they cover the independent tasks of monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure is intended to verify a property after the relevant resource or data evaluation: A lifecycle postcondition checks an expected guarantee and can prevent dependent operations when it fails; it differs from a pre-operation assumption; this behavior should be assessed against the concrete need to monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule. The second measure is intended to ensure a module only exposes results that satisfy a contract: 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 monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule. Neither is the directly designated method for the separate goals of monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule in this review.
B:The second measure does meet the validate every element of a collection against one rule requirement, but the first is designed for another concern: Try handles dynamic evaluation failures in expressions and can help normalize inputs; it does not itself fail the configuration when the fallback is used; this behavior should be assessed against the concrete need to monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule. That first component is designed to provide a fallback when a dynamic attribute path is absent, which does not accomplish the requested task to monitor an infrastructure invariant and report failed checks without blocking the whole operation, even though the other measure satisfies validate every element of a collection against one rule.
D:The first measure meets the requirement to monitor an infrastructure invariant and report failed checks without blocking the whole operation, but its partner serves a different role: An assert block carries the condition and explanatory error text for a named check; it is not a normal managed resource declaration; this behavior should be assessed against the concrete need to monitor an infrastructure invariant and report failed checks without blocking the whole operation and validate every element of a collection against one rule. That second component is designed to express the Boolean invariant and its diagnostic message, so the still-missing criterion is to validate every element of a collection against one rule, while the first criterion remains monitor an infrastructure invariant and report failed checks without blocking the whole operation.
Question 292
A Terraform team is hardening secret management. Two independent changes are requested: first, prevent credentials from entering source history; second, avoid leaking inputs and backend information through CI downloads. Which pair of measures fulfills both?
- Use HCP Terraform sensitive workspace variables + Avoid unnecessary
nonsensitive(...) calls
- Use an
ephemeral resource to retrieve supported temporary secrets + Treat saved plan files as sensitive artifacts
- Avoid committing secret
.tfvars values + Use environment-based provider authentication when supported
- Avoid committing secret
.tfvars values + Treat saved plan files as sensitive artifacts
Explanation
Correct Answer
D:For the first criterion, input files can contain plaintext and are often copied to laptops and CI systems; store sensitive values in a managed secret store or protected execution environment instead; this behavior should be assessed against the concrete need to prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads; this directly addresses the need to prevent credentials from entering source history. For the separate second criterion, 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 prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads; this fulfills the need to avoid leaking inputs and backend information through CI downloads. Together they cover the independent tasks of prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure is intended to restrict display of secret input values in hosted runs: HCP Terraform offers marked-sensitive variables for workspace runs; their handling is a platform feature, not evidence that every resulting resource attribute is absent from state; this behavior should be assessed against the concrete need to prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads. The second measure is intended to preserve Terraform's safety indicator for secret-bearing expressions: 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 prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads. Neither is the directly designated method for the separate goals of prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads in this review.
B:The second measure does meet the avoid leaking inputs and backend information through CI downloads requirement, but the first is designed for another concern: Ephemeral resources avoid persisting their results in Terraform's normal state and plan artifacts; their values cannot be used in arbitrary persistent resource fields; this behavior should be assessed against the concrete need to prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads. That first component is designed to obtain runtime-only data through an ephemeral provider operation, which does not accomplish the requested task to prevent credentials from entering source history, even though the other measure satisfies avoid leaking inputs and backend information through CI downloads.
C:The first measure meets the requirement to prevent credentials from entering source history, but its partner serves a different role: Many providers support environment variables or workload identity; this lowers credential exposure in source but still requires secure runtime injection; this behavior should be assessed against the concrete need to prevent credentials from entering source history and avoid leaking inputs and backend information through CI downloads. That second component is designed to avoid embedding long-lived credentials in HCL provider blocks, so the still-missing criterion is to avoid leaking inputs and backend information through CI downloads, while the first criterion remains prevent credentials from entering source history.
Question 293
An HCL author is separating managed infrastructure from lookups. The checklist contains independent tasks: (1) compute reusable expression results without creating an API object; (2) read an object without asking Terraform to create or manage it; (3) consume the ID of an object declared through a resource block. Which three options directly correspond to the respective tasks? Choose THREE.
- Query an existing object with
data
- Declare a managed object with
resource
- Read data sources during planning when inputs are known
- Reference
aws_instance.web.id for a managed resource
- Distinguish
locals from remote resource declarations
- Use provider selection on both resource and data blocks
Explanation
Correct Answers
A: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 compute reusable expression results without creating an API object and read an object without asking Terraform to create or manage it and consume the ID of an object declared through a resource block. This matches the distinct objective to read an object without asking Terraform to create or manage it; the remaining chosen features address compute reusable expression results without creating an API object and consume the ID of an object declared through a resource block.
D: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 compute reusable expression results without creating an API object and read an object without asking Terraform to create or manage it and consume the ID of an object declared through a resource block. This matches the distinct objective to consume the ID of an object declared through a resource block; the remaining chosen features address compute reusable expression results without creating an API object and read an object without asking Terraform to create or manage it.
E: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 compute reusable expression results without creating an API object and read an object without asking Terraform to create or manage it and consume the ID of an object declared through a resource block. This matches the distinct objective to compute reusable expression results without creating an API object; the remaining chosen features address read an object without asking Terraform to create or manage it and consume the ID of an object declared through a resource block.
Incorrect Answers
B: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 compute reusable expression results without creating an API object and read an object without asking Terraform to create or manage it and consume the ID of an object declared through a resource block. Its main application is to ask Terraform to own the lifecycle of a remote object; the checklist instead asks for compute reusable expression results without creating an API object; and read an object without asking Terraform to create or manage it; and consume the ID of an object declared through a resource block. None of those distinct criteria specifically calls for this alternative.
C:Terraform normally asks the provider to read data sources during a plan; reads may be deferred when inputs or dependent changes are not yet known; this behavior should be assessed against the concrete need to compute reusable expression results without creating an API object and read an object without asking Terraform to create or manage it and consume the ID of an object declared through a resource block. Its main application is to retrieve remote information for evaluating the proposed change; the checklist instead asks for compute reusable expression results without creating an API object; and read an object without asking Terraform to create or manage it; and consume the ID of an object declared through a resource block. None of those distinct criteria specifically calls for this alternative.
F: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 compute reusable expression results without creating an API object and read an object without asking Terraform to create or manage it and consume the ID of an object declared through a resource block. Its main application is to direct API operations and lookups to the intended account or region; the checklist instead asks for compute reusable expression results without creating an API object; and read an object without asking Terraform to create or manage it; and consume the ID of an object declared through a resource block. None of those distinct criteria specifically calls for this alternative.
Question 294
An HCL review is investigating dependency and reference syntax. The requirement is to extract values from instances created with for_each. Which Terraform mechanism directly meets this requirement?
- Use
var.region
- Use
count.index inside counted blocks
- Use
data.type.name.attribute
- Use a
for expression over a resource map
- Use
output to expose child internals intentionally
Explanation
Correct Answer
D: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 extract values from instances created with for_each. This directly supports the task to extract values from instances created with for_each during an automated release.
Incorrect Answers
A:The var. namespace refers to values supplied through the module's interface; it does not directly fetch provider configuration or remote state; this behavior should be assessed against the concrete need to extract values from instances created with for_each. The distinction matters here: using that mechanism to read a module input variable inside that module would still leave the objective to extract values from instances created with for_each unmet.
B: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 extract values from instances created with for_each. It may support a related workflow, but the question specifically requires the mechanism for extract values from instances created with for_each rather than identify the zero-based index of the current instance.
C:The data. prefix selects a read-only lookup namespace; without the prefix Terraform would interpret the address as a managed resource; this behavior should be assessed against the concrete need to extract values from instances created with for_each. The stated requirement is to extract values from instances created with for_each, not to retrieve an attribute of a declared data source; this alternative addresses a different control or phase.
E: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 extract values from instances created with for_each. The distinction matters here: using that mechanism to create a stable boundary for modules that callers depend on would still leave the objective to extract values from instances created with for_each unmet.
Question 295
During a deployment checklist, one task is to make callers supply a necessary input during planning or applying, while another is to prevent a temporary secret from being persisted to state and plan files. Select the matching pair of techniques.
- Omit
default to require a variable value + Mark an input variable ephemeral = true
- Mark a sensitive output
sensitive = true + Mark an input variable ephemeral = true
- Use
terraform.tfvars or *.auto.tfvars + Declare variable "name" with a type constraint
- Omit
default to require a variable value + Recognize variable scope is per module
- Define
output for a root result + Mark an input variable ephemeral = true
- Omit
default to require a variable value + Use validation inside a variable block
Explanation
Correct Answer
A:For the first criterion, a variable without a default is required; terraform prompts when interactive input is allowed or reports missing input otherwise; this behavior should be assessed against the concrete need to make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files; this directly addresses the need to make callers supply a necessary input during planning or applying. For the separate second criterion, 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 make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files; this fulfills the need to prevent a temporary secret from being persisted to state and plan files. Together they cover the independent tasks of make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files without exchanging the responsibilities of these features.
Incorrect Answers
B:The second measure does meet the prevent a temporary secret from being persisted to state and plan files requirement, but the first is designed for another concern: Sensitive outputs are redacted in typical CLI presentation but remain recoverable from state by authorized readers; a root output is not secure secret storage; this behavior should be assessed against the concrete need to make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files. That first component is designed to avoid showing a secret output value in normal human-readable CLI displays, which does not accomplish the requested task to make callers supply a necessary input during planning or applying, even though the other measure satisfies prevent a temporary secret from being persisted to state and plan files.
C:The first measure is intended to automatically load documented variable files in a root module: Terraform discovers these conventional names during CLI runs; arbitrarily named .tfvars files require explicit selection; this behavior should be assessed against the concrete need to make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files. The second measure is intended to enforce the expected shape of a module input: Input types such as string, list(string), or object(...) describe accepted values; terraform checks the supplied value against this contract; this behavior should be assessed against the concrete need to make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files. Neither is the directly designated method for the separate goals of make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files in this review.
D:The first measure meets the requirement to make callers supply a necessary input during planning or applying, but its partner serves a different role: A child declares its own inputs and receives values in the module call; variables do not automatically become global across the module tree; this behavior should be assessed against the concrete need to make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files. That second component is designed to avoid reading a root input directly from an unrelated child module, so the still-missing criterion is to prevent a temporary secret from being persisted to state and plan files, while the first criterion remains make callers supply a necessary input during planning or applying.
E:The second measure does meet the prevent a temporary secret from being persisted to state and plan files requirement, but the first is designed for another concern: 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 make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files. That first component is designed to expose a selected computed value after provisioning, which does not accomplish the requested task to make callers supply a necessary input during planning or applying, even though the other measure satisfies prevent a temporary secret from being persisted to state and plan files.
F:The first measure meets the requirement to make callers supply a necessary input during planning or applying, but its partner serves a different role: The condition and custom error message give feedback near the module boundary; it is not an HCP policy set or a provider API permission check; this behavior should be assessed against the concrete need to make callers supply a necessary input during planning or applying and prevent a temporary secret from being persisted to state and plan files. That second component is designed to reject caller inputs that violate a Boolean rule, so the still-missing criterion is to prevent a temporary secret from being persisted to state and plan files, while the first criterion remains make callers supply a necessary input during planning or applying.
Question 296
An author is choosing between ordered and keyed inputs. The checklist contains independent tasks: (1) retrieve the first element of an ordered collection; (2) produce a list value when a downstream expression requires list semantics. Which two options directly correspond to the respective tasks? Choose TWO.
- Use
optional(...) in object attributes
- Use
type = any sparingly
- Recognize map iteration's key ordering
- Access a list with
var.zones[0]
- Convert values with
tolist(...)
Explanation
Correct Answers
D:Lists use zero-based positional indices; a set lacks a stable positional index for this purpose; this behavior should be assessed against the concrete need to retrieve the first element of an ordered collection and produce a list value when a downstream expression requires list semantics. This matches the distinct objective to retrieve the first element of an ordered collection; the remaining chosen features address produce a list value when a downstream expression requires list semantics.
E:The conversion yields a list but an unordered source set may produce an arbitrary order; do not use it to promise stable positions for set elements; this behavior should be assessed against the concrete need to retrieve the first element of an ordered collection and produce a list value when a downstream expression requires list semantics. This matches the distinct objective to produce a list value when a downstream expression requires list semantics; the remaining chosen features address retrieve the first element of an ordered collection.
Incorrect Answers
A:Optional attributes let module callers omit selected fields and may provide defaults; they do not make unrelated required object attributes optional; this behavior should be assessed against the concrete need to retrieve the first element of an ordered collection and produce a list value when a downstream expression requires list semantics. Its main application is to allow an object field to be omitted from a typed input; the checklist instead asks for retrieve the first element of an ordered collection; and produce a list value when a downstream expression requires list semantics. None of those distinct criteria specifically calls for this alternative.
B:The any placeholder relaxes static expectations but sacrifices early type guarantees; most module interfaces benefit from a concrete type; this behavior should be assessed against the concrete need to retrieve the first element of an ordered collection and produce a list value when a downstream expression requires list semantics. Its main application is to permit values of varying shapes where a strict contract is impractical; the checklist instead asks for retrieve the first element of an ordered collection; and produce a list value when a downstream expression requires list semantics. None of those distinct criteria specifically calls for this alternative.
C: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 retrieve the first element of an ordered collection and produce a list value when a downstream expression requires list semantics. Its main application is to avoid interpreting maps as insertion-ordered sequences; the checklist instead asks for retrieve the first element of an ordered collection; and produce a list value when a downstream expression requires list semantics. None of those distinct criteria specifically calls for this alternative.
Question 297
A Terraform review separates 3 requirements: (1) collect the same attribute from every list-like object; (2) require every evaluated Boolean in a collection to be true; (3) remove duplicate list elements while preserving first occurrence order. Identify the three features that each directly handle one of those requirements. Choose THREE.
- Use
... in a grouped object for expression
- Use a splat expression
items[*].id
- Use
count for numbered resource instances
- Use
distinct(list)
- Use
alltrue(list_of_bools)
- Use
setproduct(a, b)
Explanation
Correct Answers
B:The [*] form is concise for sequences; map-valued for_each resources usually require a for expression instead; this behavior should be assessed against the concrete need to collect the same attribute from every list-like object and require every evaluated Boolean in a collection to be true and remove duplicate list elements while preserving first occurrence order. This matches the distinct objective to collect the same attribute from every list-like object; the remaining chosen features address require every evaluated Boolean in a collection to be true and remove duplicate list elements while preserving first occurrence order.
D:Distinct retains a list representation with unique values; it is useful when order still matters and a set would alter semantics; this behavior should be assessed against the concrete need to collect the same attribute from every list-like object and require every evaluated Boolean in a collection to be true and remove duplicate list elements while preserving first occurrence order. This matches the distinct objective to remove duplicate list elements while preserving first occurrence order; the remaining chosen features address collect the same attribute from every list-like object and require every evaluated Boolean in a collection to be true.
E:Alltrue is useful for validating all entries in an input list; anytrue instead tests whether at least one entry succeeds; this behavior should be assessed against the concrete need to collect the same attribute from every list-like object and require every evaluated Boolean in a collection to be true and remove duplicate list elements while preserving first occurrence order. This matches the distinct objective to require every evaluated Boolean in a collection to be true; the remaining chosen features address collect the same attribute from every list-like object and remove duplicate list elements while preserving first occurrence order.
Incorrect Answers
A:Grouping mode aggregates multiple values under the same generated key; ordinary object comprehensions require unique keys; this behavior should be assessed against the concrete need to collect the same attribute from every list-like object and require every evaluated Boolean in a collection to be true and remove duplicate list elements while preserving first occurrence order. Its main application is to collect duplicate output keys into lists instead of reporting collisions; the checklist instead asks for collect the same attribute from every list-like object; and require every evaluated Boolean in a collection to be true; and remove duplicate list elements while preserving first occurrence order. None of those distinct criteria specifically calls for this alternative.
C:Count produces addresses indexed by integers; changing list order may shift how items map to instances when coupled with positional inputs; this behavior should be assessed against the concrete need to collect the same attribute from every list-like object and require every evaluated Boolean in a collection to be true and remove duplicate list elements while preserving first occurrence order. Its main application is to create a known number of repeated managed resource instances; the checklist instead asks for collect the same attribute from every list-like object; and require every evaluated Boolean in a collection to be true; and remove duplicate list elements while preserving first occurrence order. None of those distinct criteria specifically calls for this alternative.
F:Setproduct computes the Cartesian product, useful for pairing environments and roles; it is not an alternative to the resource dependency graph; this behavior should be assessed against the concrete need to collect the same attribute from every list-like object and require every evaluated Boolean in a collection to be true and remove duplicate list elements while preserving first occurrence order. Its main application is to create every ordered combination across two input collections; the checklist instead asks for collect the same attribute from every list-like object; and require every evaluated Boolean in a collection to be true; and remove duplicate list elements while preserving first occurrence order. None of those distinct criteria specifically calls for this alternative.
Question 298
A platform team must control dependencies and replacements. The team must both allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement. Which paired choice implements those distinct goals?
- Use graph parallelism for independent resources + Recognize propagated
create_before_destroy behavior
- Use an attribute reference for an implicit edge + Recognize lifecycle arguments are evaluated early
- Use
ignore_changes = [tags] + Recognize propagated create_before_destroy behavior
- Use graph parallelism for independent resources + Understand destroy order as dependency-aware
Explanation
Correct Answer
A:For the first criterion, terraform can schedule independent graph nodes in parallel within its configured limit; artificial dependencies reduce parallel execution; this behavior should be assessed against the concrete need to allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement; this directly addresses the need to allow unrelated operations to proceed concurrently. For the separate second criterion, terraform may propagate create-before-destroy to dependencies and preserve that decision in state; a downstream replacement can therefore affect upstream lifecycle ordering; this behavior should be assessed against the concrete need to allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement; this fulfills the need to understand why a dependency may also be retained during a replacement. Together they cover the independent tasks of allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement without exchanging the responsibilities of these features.
Incorrect Answers
B:The first measure is intended to order resources when the second consumes a value from the first: Terraform builds a dependency from the expression reference; a separate explicit ordering rule is unnecessary when data flow already expresses the relationship; this behavior should be assessed against the concrete need to allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement. The second measure is intended to avoid dynamic expressions for create_before_destroy and similar rules: These lifecycle settings shape the graph construction stage and typically require literal values; a runtime input cannot freely toggle them as ordinary arguments; this behavior should be assessed against the concrete need to allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement. Neither is the directly designated method for the separate goals of allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement in this review.
C:The second measure does meet the understand why a dependency may also be retained during a replacement requirement, but the first is designed for another concern: 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 allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement. That first component is designed to exclude selected post-creation attribute differences from update planning, which does not accomplish the requested task to allow unrelated operations to proceed concurrently, even though the other measure satisfies understand why a dependency may also be retained during a replacement.
D:The first measure meets the requirement to allow unrelated operations to proceed concurrently, but its partner serves a different role: Terraform generally reverses dependency order for teardown; this minimizes failures caused by destroying prerequisites too early; this behavior should be assessed against the concrete need to allow unrelated operations to proceed concurrently and understand why a dependency may also be retained during a replacement. That second component is designed to remove dependents before the infrastructure they rely on, so the still-missing criterion is to understand why a dependency may also be retained during a replacement, while the first criterion remains allow unrelated operations to proceed concurrently.
Question 299
A deployment must validate assumptions or outcomes. The requirement is to tell users which contract failed and why. Which Terraform mechanism directly meets this requirement?
- Use a variable
validation block
- Use a
check block with assertions
- Use an output
precondition
- Use
error_message for actionable custom diagnostics
Explanation
Correct Answer
D: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 tell users which contract failed and why. This directly supports the task to tell users which contract failed and why during a planned migration.
Incorrect Answers
A:A variable validation condition evaluates to a Boolean and reports the specified error when false; it sets the input contract independently of provider API permissions; this behavior should be assessed against the concrete need to tell users which contract failed and why. That can be useful when the aim is to reject a malformed module input with a custom message, but it does not directly deliver the requested ability to tell users which contract failed and why.
B:Checks are designed for nonblocking validation and can report warnings during plan/apply; critical prerequisites belong in blocking custom conditions; this behavior should be assessed against the concrete need to tell users which contract failed and why. The distinction matters here: using that mechanism to monitor an infrastructure invariant and report failed checks without blocking the whole operation would still leave the objective to tell users which contract failed and why unmet.
C: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 tell users which contract failed and why. It may support a related workflow, but the question specifically requires the mechanism for tell users which contract failed and why rather than ensure a module only exposes results that satisfy a contract.
Question 300
During a module implementation, one task is to obtain runtime-only data through an ephemeral provider operation, while another is to prevent credentials from entering source history. Select the matching pair of techniques.
- Use an
ephemeral resource to retrieve supported temporary secrets + Treat saved plan files as sensitive artifacts
- Distinguish
ephemeral from sensitive + Avoid committing secret .tfvars values
- Use an
ephemeral resource to retrieve supported temporary secrets + Avoid committing secret .tfvars values
- Protect access to remote state + Use HCP Terraform sensitive workspace variables
Explanation
Correct Answer
C:For the first criterion, ephemeral resources avoid persisting their results in Terraform's normal state and plan artifacts; their values cannot be used in arbitrary persistent resource fields; this behavior should be assessed against the concrete need to obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history; this directly addresses the need to obtain runtime-only data through an ephemeral provider operation. For the separate second criterion, input files can contain plaintext and are often copied to laptops and CI systems; store sensitive values in a managed secret store or protected execution environment instead; this behavior should be assessed against the concrete need to obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history; this fulfills the need to prevent credentials from entering source history. Together they cover the independent tasks of obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure meets the requirement to obtain runtime-only data through an ephemeral provider operation, but its partner serves a different role: 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 obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history. That second component is designed to avoid leaking inputs and backend information through CI downloads, so the still-missing criterion is to prevent credentials from entering source history, while the first criterion remains obtain runtime-only data through an ephemeral provider operation.
B:The second measure does meet the prevent credentials from entering source history requirement, but the first is designed for another concern: 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 obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history. That first component is designed to choose secrecy controls based on persistence as well as output redaction, which does not accomplish the requested task to obtain runtime-only data through an ephemeral provider operation, even though the other measure satisfies prevent credentials from entering source history.
D:The first measure is intended to secure resource attributes and possibly persisted secrets: A remote backend may encrypt stored state and enforce access controls; terraform sensitive annotations do not replace backend security; this behavior should be assessed against the concrete need to obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history. The second measure is intended to restrict display of secret input values in hosted runs: HCP Terraform offers marked-sensitive variables for workspace runs; their handling is a platform feature, not evidence that every resulting resource attribute is absent from state; this behavior should be assessed against the concrete need to obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history. Neither is the directly designated method for the separate goals of obtain runtime-only data through an ephemeral provider operation and prevent credentials from entering source history in this review.