Question 280
A configuration review examines list, map, object, tuple, and set semantics. Two independent changes are requested: first, produce a list value when a downstream expression requires list semantics; second, collapse a list of lists into one sequence. Which pair of measures fulfills both?
- Convert values with
tolist(...) + Use flatten(...) for nested lists
- Use
tomap(...) to make a map + Use flatten(...) for nested lists
- Use
object({ name = string, enabled = bool }) + Use structural object attributes in module interfaces
- Convert values with
tolist(...) + Use list(string) for ordered strings
Explanation
Correct Answer
A:For the first criterion, 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 produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence; this directly addresses the need to produce a list value when a downstream expression requires list semantics. For the separate second criterion, 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 produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence; this fulfills the need to collapse a list of lists into one sequence. Together they cover the independent tasks of produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence without exchanging the responsibilities of these features.
Incorrect Answers
B:The second measure does meet the collapse a list of lists into one sequence requirement, but the first is designed for another concern: Map conversion attempts a common element type for the values; a heterogeneous object may need a more explicit object contract instead; this behavior should be assessed against the concrete need to produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence. That first component is designed to convert a compatible value into a homogeneous keyed collection, which does not accomplish the requested task to produce a list value when a downstream expression requires list semantics, even though the other measure satisfies collapse a list of lists into one sequence.
C:The first 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 produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence. The second measure is intended to validate required properties rather than accepting arbitrary untyped maps: A typed object can express nested requirements clearly; it improves errors when a caller omits a field or supplies an incompatible value; this behavior should be assessed against the concrete need to produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence. Neither is the directly designated method for the separate goals of produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence in this review.
D:The first measure meets the requirement to produce a list value when a downstream expression requires list semantics, but its partner serves a different role: 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 produce a list value when a downstream expression requires list semantics and collapse a list of lists into one sequence. That second component is designed to preserve a sequence in which position and duplicates may matter, so the still-missing criterion is to collapse a list of lists into one sequence, while the first criterion remains produce a list value when a downstream expression requires list semantics.
Question 281
During a deployment checklist, one task is to recover from dynamic expression errors with an alternative result, while another is to serialize a Terraform value into JSON text for an API argument. Select the matching pair of techniques.
- Use
split(delimiter, string) + Use jsondecode(text)
- Use
try(expr, fallback) + Use jsonencode(value)
- Use
file(path) to read local text + Use jsonencode(value)
- Use
try(expr, fallback) + Use alltrue(list_of_bools)
Explanation
Correct Answer
B:For the first criterion, try evaluates arguments until one succeeds; it should not mask known structural errors or replace explicit input validation; this behavior should be assessed against the concrete need to recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument; this directly addresses the need to recover from dynamic expression errors with an alternative result. For the separate second criterion, 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 recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument; this fulfills the need to serialize a Terraform value into JSON text for an API argument. Together they cover the independent tasks of recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure is intended to divide text into a list around a separator: Split produces a sequence of pieces; it does not construct a map from the resulting values automatically; this behavior should be assessed against the concrete need to recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument. The second measure is intended to parse JSON into Terraform lists, objects, numbers, strings, and Booleans: Decoding returns native expression values; it is not a remote data-source read or a YAML parser; this behavior should be assessed against the concrete need to recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument. Neither is the directly designated method for the separate goals of recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument in this review.
C:The second measure does meet the serialize a Terraform value into JSON text for an API argument requirement, but the first is designed for another concern: File reads files present when evaluation starts; it is not a dependency-aware way to read a file that a resource will create during apply; this behavior should be assessed against the concrete need to recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument. That first component is designed to obtain existing UTF-8 file contents during expression evaluation, which does not accomplish the requested task to recover from dynamic expression errors with an alternative result, even though the other measure satisfies serialize a Terraform value into JSON text for an API argument.
D:The first measure meets the requirement to recover from dynamic expression errors with an alternative result, but its partner serves a different role: 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 recover from dynamic expression errors with an alternative result and serialize a Terraform value into JSON text for an API argument. That second component is designed to require every evaluated Boolean in a collection to be true, so the still-missing criterion is to serialize a Terraform value into JSON text for an API argument, while the first criterion remains recover from dynamic expression errors with an alternative result.
Question 282
The immediate Terraform task is to represent an input change through a managed resource lifecycle. Which method handles that task most directly?
- Avoid a circular dependency graph
- Use
terraform_data for value-driven replacement triggers
- Use
depends_on for a hidden dependency
- Use
replace_triggered_by for resource change coupling
Explanation
Correct Answer
B: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 represent an input change through a managed resource lifecycle. This directly supports the task to represent an input change through a managed resource lifecycle during a configuration change.
Incorrect Answers
A: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 represent an input change through a managed resource lifecycle. The stated requirement is to represent an input change through a managed resource lifecycle, not to break mutual dependencies that prevent Terraform from ordering operations; this alternative addresses a different control or phase.
C:Explicit dependencies model side effects or prerequisites that Terraform cannot infer from values; they may reduce concurrency or defer data-source reads; this behavior should be assessed against the concrete need to represent an input change through a managed resource lifecycle. The distinction matters here: using that mechanism to order operations even when no output attribute is consumed would still leave the objective to represent an input change through a managed resource lifecycle unmet.
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 represent an input change through a managed resource lifecycle. It may support a related workflow, but the question specifically requires the mechanism for represent an input change through a managed resource lifecycle rather than replace a resource when another managed resource or attribute changes.
Question 283
In an automated release, the requested result is to separate structural HCL checking from runtime assertions. What should the engineer select?
- Use variable validation for valid network prefixes
- Use a resource
precondition
- Distinguish
terraform validate from in-configuration conditions
- Use a resource
postcondition
Explanation
Correct Answer
C:The CLI validation command checks configuration consistency; custom conditions examine values and guarantees at relevant evaluation phases; this behavior should be assessed against the concrete need to separate structural HCL checking from runtime assertions. This directly supports the task to separate structural HCL checking from runtime assertions during a module implementation.
Incorrect Answers
A: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 separate structural HCL checking from runtime assertions. It may support a related workflow, but the question specifically requires the mechanism for separate structural HCL checking from runtime assertions rather than reject malformed or disallowed input before resource creation.
B: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 separate structural HCL checking from runtime assertions. The stated requirement is to separate structural HCL checking from runtime assertions, not to verify an assumption before Terraform processes the target resource operation; this alternative addresses a different control or phase.
D: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 separate structural HCL checking from runtime assertions. The distinction matters here: using that mechanism to verify a property after the relevant resource or data evaluation would still leave the objective to separate structural HCL checking from runtime assertions unmet.
Question 284
An engineer needs to prevent credentials from entering source history as part of an automated release. Which option is the best fit?
- Avoid unnecessary
nonsensitive(...) calls
- Use an
ephemeral resource to retrieve supported temporary secrets
- Mark a secret root output
sensitive = true
- Avoid committing secret
.tfvars values
Explanation
Correct Answer
D: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. This directly supports the task to prevent credentials from entering source history during an infrastructure audit.
Incorrect Answers
A: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. The distinction matters here: using that mechanism to preserve Terraform's safety indicator for secret-bearing expressions would still leave the objective to prevent credentials from entering source history unmet.
B: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. It may support a related workflow, but the question specifically requires the mechanism for prevent credentials from entering source history rather than obtain runtime-only data through an ephemeral provider operation.
C:Output sensitivity masks typical CLI views; authorized state readers and certain machine-readable commands may still reveal the value; this behavior should be assessed against the concrete need to prevent credentials from entering source history. The stated requirement is to prevent credentials from entering source history, not to avoid normal display of an output carrying sensitive data; this alternative addresses a different control or phase.
Question 285
During an infrastructure audit, the team must accomplish all of these distinct aims: (1) direct API operations and lookups to the intended account or region; (2) distinguish a failed lookup from a request to create the missing object. Select exactly the two relevant mechanisms. Choose TWO.
- Distinguish
locals from remote resource declarations
- Use provider selection on both resource and data blocks
- Understand data source failure on a missing object
- Use an
ephemeral resource for supported temporary data
- Read data sources during planning when inputs are known
Explanation
Correct Answers
B: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 direct API operations and lookups to the intended account or region and distinguish a failed lookup from a request to create the missing object. This matches the distinct objective to direct API operations and lookups to the intended account or region; the remaining chosen features address distinguish a failed lookup from a request to create the missing object.
C:Many provider data sources require a matching remote object and report an error when none exists; terraform does not create a replacement solely because the data block is present; this behavior should be assessed against the concrete need to direct API operations and lookups to the intended account or region and distinguish a failed lookup from a request to create the missing object. This matches the distinct objective to distinguish a failed lookup from a request to create the missing object; the remaining chosen features address direct API operations and lookups to the intended account or region.
Incorrect Answers
A: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 direct API operations and lookups to the intended account or region and distinguish a failed lookup from a request to create the missing object. Its main application is to compute reusable expression results without creating an API object; the checklist instead asks for direct API operations and lookups to the intended account or region; and distinguish a failed lookup from a request to create the missing object. None of those distinct criteria specifically calls for this alternative.
D:Ephemeral resources are available for supported providers and valid contexts; they are not ordinary managed resources with persistent state identity; this behavior should be assessed against the concrete need to direct API operations and lookups to the intended account or region and distinguish a failed lookup from a request to create the missing object. Its main application is to obtain a short-lived value without persisting it in state or plan; the checklist instead asks for direct API operations and lookups to the intended account or region; and distinguish a failed lookup from a request to create the missing object. None of those distinct criteria specifically calls for this alternative.
E: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 direct API operations and lookups to the intended account or region and distinguish a failed lookup from a request to create the missing object. Its main application is to retrieve remote information for evaluating the proposed change; the checklist instead asks for direct API operations and lookups to the intended account or region; and distinguish a failed lookup from a request to create the missing object. None of those distinct criteria specifically calls for this alternative.
Question 286
A module consumer must reference attributes from other blocks. The team must both retrieve an attribute of a declared data source and read a module input variable inside that module. Which paired choice implements those distinct goals?
- Use
data.type.name.attribute + Use var.region
- Avoid cyclic resource references + Use
var.region
- Use
depends_on for hidden ordering requirements + Use var.region
- Use
module.network.subnet_id + Use a for expression over a resource map
- Use
data.type.name.attribute + Use local.prefix
Explanation
Correct Answer
A:For the first criterion, 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 retrieve an attribute of a declared data source and read a module input variable inside that module; this directly addresses the need to retrieve an attribute of a declared data source. For the separate second criterion, 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 retrieve an attribute of a declared data source and read a module input variable inside that module; this fulfills the need to read a module input variable inside that module. Together they cover the independent tasks of retrieve an attribute of a declared data source and read a module input variable inside that module without exchanging the responsibilities of these features.
Incorrect Answers
B:The second measure does meet the read a module input variable inside that module requirement, but the first is designed for another concern: A circular dependency has no acyclic execution order; splitting responsibilities or breaking unnecessary references resolves the cycle; this behavior should be assessed against the concrete need to retrieve an attribute of a declared data source and read a module input variable inside that module. That first component is designed to prevent a graph in which objects depend on each other without a valid ordering, which does not accomplish the requested task to retrieve an attribute of a declared data source, even though the other measure satisfies read a module input variable inside that module.
C:The second measure does meet the read a module input variable inside that module requirement, but the first is designed for another concern: Terraform's graph uses the explicit edge even without a data reference; overusing whole-resource dependencies may defer reads and reduce concurrency; this behavior should be assessed against the concrete need to retrieve an attribute of a declared data source and read a module input variable inside that module. That first component is designed to declare a relationship that cannot be expressed through an input attribute, which does not accomplish the requested task to retrieve an attribute of a declared data source, even though the other measure satisfies read a module input variable inside that module.
D:The first measure is intended to consume a value explicitly exposed by a child module: 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 retrieve an attribute of a declared data source and read a module input variable inside that module. The second 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 retrieve an attribute of a declared data source and read a module input variable inside that module. Neither is the directly designated method for the separate goals of retrieve an attribute of a declared data source and read a module input variable inside that module in this review.
E:The first measure meets the requirement to retrieve an attribute of a declared data source, but its partner serves a different role: Local expressions help avoid repeating calculations; each module has its own local namespace; callers cannot directly inspect a child's locals; this behavior should be assessed against the concrete need to retrieve an attribute of a declared data source and read a module input variable inside that module. That second component is designed to reference a computed local value in the same module, so the still-missing criterion is to read a module input variable inside that module, while the first criterion remains retrieve an attribute of a declared data source.
Question 287
A reviewer is auditing variable scopes and disclosure behavior. Two independent changes are requested: first, transfer computed values from a child module to its caller; second, reject explicit null values instead of treating them as ordinary accepted inputs. Which pair of measures fulfills both?
- Use
validation inside a variable block + Set nullable = false for a required non-null variable
- Recognize variable scope is per module + Use
terraform.tfvars or *.auto.tfvars
- Use
terraform output -json for machine-readable results + Set nullable = false for a required non-null variable
- Use a child-module output as
module.app.endpoint + Set default for an optional configuration input
- Use a child-module output as
module.app.endpoint + Mark an input variable ephemeral = true
- Use a child-module output as
module.app.endpoint + Set nullable = false for a required non-null variable
Explanation
Correct Answer
F:For the first criterion, only declared outputs form the public child-module interface; the caller cannot directly use an internal resource just by knowing its internal name; this behavior should be assessed against the concrete need to transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs; this directly addresses the need to transfer computed values from a child module to its caller. For the separate second criterion, the nullable setting controls whether null can be supplied; it is different from a missing default and distinct from sensitive output masking; this behavior should be assessed against the concrete need to transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs; this fulfills the need to reject explicit null values instead of treating them as ordinary accepted inputs. Together they cover the independent tasks of transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the reject explicit null values instead of treating them as ordinary accepted inputs requirement, but the first is designed for another concern: 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 transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs. That first component is designed to reject caller inputs that violate a Boolean rule, which does not accomplish the requested task to transfer computed values from a child module to its caller, even though the other measure satisfies reject explicit null values instead of treating them as ordinary accepted inputs.
B:The first measure is intended to avoid reading a root input directly from an unrelated child module: 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 transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs. The second 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 transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs. Neither is the directly designated method for the separate goals of transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs in this review.
C:The second measure does meet the reject explicit null values instead of treating them as ordinary accepted inputs requirement, but the first is designed for another concern: JSON mode includes values and sensitivity metadata; downstream tooling must treat sensitive data carefully; this command reads recorded outputs, not arbitrary provider API properties; this behavior should be assessed against the concrete need to transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs. That first component is designed to obtain structured output values in scripts, which does not accomplish the requested task to transfer computed values from a child module to its caller, even though the other measure satisfies reject explicit null values instead of treating them as ordinary accepted inputs.
D:The first measure meets the requirement to transfer computed values from a child module to its caller, but its partner serves a different role: 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 transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs. That second component is designed to supply a fallback when the caller omits the variable, so the still-missing criterion is to reject explicit null values instead of treating them as ordinary accepted inputs, while the first criterion remains transfer computed values from a child module to its caller.
E:The first measure meets the requirement to transfer computed values from a child module to its caller, but its partner serves a different role: 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 transfer computed values from a child module to its caller and reject explicit null values instead of treating them as ordinary accepted inputs. That second component is designed to prevent a temporary secret from being persisted to state and plan files, so the still-missing criterion is to reject explicit null values instead of treating them as ordinary accepted inputs, while the first criterion remains transfer computed values from a child module to its caller.
Question 288
During a platform review, the team must accomplish all of these distinct aims: (1) read a string-keyed collection value; (2) remove duplicates and produce set semantics for iteration. Select exactly the two relevant mechanisms. Choose TWO.
- Access a list with
var.zones[0]
- Convert values with
toset(...)
- Use
optional(...) in object attributes
- Convert values with
tolist(...)
- Access a map with
var.tags["owner"]
Explanation
Correct Answers
B: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 read a string-keyed collection value and remove duplicates and produce set semantics for iteration. This matches the distinct objective to remove duplicates and produce set semantics for iteration; the remaining chosen features address read a string-keyed collection value.
E:Bracket indexing selects an entry by key; a numeric list index such as [0] is not a substitute for a map key; this behavior should be assessed against the concrete need to read a string-keyed collection value and remove duplicates and produce set semantics for iteration. This matches the distinct objective to read a string-keyed collection value; the remaining chosen features address remove duplicates and produce set semantics for iteration.
Incorrect Answers
A: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 read a string-keyed collection value and remove duplicates and produce set semantics for iteration. Its main application is to retrieve the first element of an ordered collection; the checklist instead asks for read a string-keyed collection value; and remove duplicates and produce set semantics for iteration. None of those distinct criteria specifically calls for this alternative.
C: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 read a string-keyed collection value and remove duplicates and produce set semantics for iteration. Its main application is to allow an object field to be omitted from a typed input; the checklist instead asks for read a string-keyed collection value; and remove duplicates and produce set semantics for iteration. None of those distinct criteria specifically calls for this alternative.
D: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 read a string-keyed collection value and remove duplicates and produce set semantics for iteration. Its main application is to produce a list value when a downstream expression requires list semantics; the checklist instead asks for read a string-keyed collection value; and remove duplicates and produce set semantics for iteration. None of those distinct criteria specifically calls for this alternative.
Question 289
A reviewer has to approve a two-part design: choose the first non-null and nonempty-string value; additionally, test whether an expression can be evaluated without an error. Which option pairs the correct mechanisms?
- Use
zipmap(keys, values) + Use setproduct(a, b)
- Use
coalesce(a, b, ...) + Use merge(map1, map2)
- Use
cidrsubnet(prefix, newbits, netnum) + Use can(expr)
- Use
coalesce(a, b, ...) + Use can(expr)
Explanation
Correct Answer
D:For the first criterion, coalesce provides a fallback over suitable scalar values; it does not catch arbitrary expression errors like try; this behavior should be assessed against the concrete need to choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error; this directly addresses the need to choose the first non-null and nonempty-string value. For the separate second criterion, can returns a Boolean and is especially useful in custom validation rules; it does not return the underlying expression's successful value; this behavior should be assessed against the concrete need to choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error; this fulfills the need to test whether an expression can be evaluated without an error. Together they cover the independent tasks of choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure is intended to assemble a map from paired key and value lists: Zipmap associates entries positionally and expects compatible list lengths; it is different from merging two already formed maps; this behavior should be assessed against the concrete need to choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error. The second measure is intended to create every ordered combination across two input collections: 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 choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error. Neither is the directly designated method for the separate goals of choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error in this review.
B:The first measure meets the requirement to choose the first non-null and nonempty-string value, but its partner serves a different role: Merge returns one map/object composed from inputs; it does not concatenate list elements or destroy original remote objects; this behavior should be assessed against the concrete need to choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error. That second component is designed to combine maps with later arguments overriding duplicate keys, so the still-missing criterion is to test whether an expression can be evaluated without an error, while the first criterion remains choose the first non-null and nonempty-string value.
C:The second measure does meet the test whether an expression can be evaluated without an error requirement, but the first is designed for another concern: CIDR functions perform address arithmetic on a known network; they do not create cloud networks or allocate provider resources; this behavior should be assessed against the concrete need to choose the first non-null and nonempty-string value and test whether an expression can be evaluated without an error. That first component is designed to derive a smaller subnet CIDR from a parent prefix, which does not accomplish the requested task to choose the first non-null and nonempty-string value, even though the other measure satisfies test whether an expression can be evaluated without an error.
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.