Question 450
In an automated release, the requested result is to delay all operations in a child module until required prerequisites complete. What should the engineer select?
- Use
ignore_changes = [tags]
- Recognize lifecycle arguments are evaluated early
- Use explicit dependencies on module calls carefully
- Use
depends_on for a hidden dependency
Explanation
Correct Answer
C: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 delay all operations in a child module until required prerequisites complete. This directly supports the task to delay all operations in a child module until required prerequisites complete during a module implementation.
Incorrect Answers
A: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 delay all operations in a child module until required prerequisites complete. That can be useful when the aim is to exclude selected post-creation attribute differences from update planning, but it does not directly deliver the requested ability to delay all operations in a child module until required prerequisites complete.
B: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 delay all operations in a child module until required prerequisites complete. The distinction matters here: using that mechanism to avoid dynamic expressions for create_before_destroy and similar rules would still leave the objective to delay all operations in a child module until required prerequisites complete unmet.
D: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 delay all operations in a child module until required prerequisites complete. The stated requirement is to delay all operations in a child module until required prerequisites complete, not to order operations even when no output attribute is consumed; this alternative addresses a different control or phase.
Question 451
An engineer needs to provide a fallback when a dynamic attribute path is absent as part of an automated release. Which option is the best fit?
- Use
assert { condition = ... } inside check
- Use
can(regex(...)) in validation
- Distinguish
terraform validate from in-configuration conditions
- Use
try for optional nested values
Explanation
Correct Answer
D: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 provide a fallback when a dynamic attribute path is absent. This directly supports the task to provide a fallback when a dynamic attribute path is absent during an infrastructure audit.
Incorrect Answers
A: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 provide a fallback when a dynamic attribute path is absent. The stated requirement is to provide a fallback when a dynamic attribute path is absent, not to express the Boolean invariant and its diagnostic message; this alternative addresses a different control or phase.
B:Regex can raise an error when no match exists; can converts that evaluability into a Boolean; it makes a precise input-validation rule possible; this behavior should be assessed against the concrete need to provide a fallback when a dynamic attribute path is absent. That can be useful when the aim is to test a string against a pattern without crashing on a nonmatch, but it does not directly deliver the requested ability to provide a fallback when a dynamic attribute path is absent.
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 provide a fallback when a dynamic attribute path is absent. The distinction matters here: using that mechanism to separate structural HCL checking from runtime assertions would still leave the objective to provide a fallback when a dynamic attribute path is absent unmet.
Question 452
An infrastructure repository handles database passwords and tokens. Two independent changes are requested: first, secure resource attributes and possibly persisted secrets; second, avoid embedding long-lived credentials in HCL provider blocks. Which pair of measures fulfills both?
- Mark a variable
ephemeral = true + Use environment-based provider authentication when supported
- Avoid committing secret
.tfvars values + Distinguish ephemeral from sensitive
- Protect access to remote state + Use environment-based provider authentication when supported
- Protect access to remote state + Use Vault to centralize secret access
Explanation
Correct Answer
C:For the first criterion, 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 secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks; this directly addresses the need to secure resource attributes and possibly persisted secrets. For the separate second criterion, 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 secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks; this fulfills the need to avoid embedding long-lived credentials in HCL provider blocks. Together they cover the independent tasks of secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the avoid embedding long-lived credentials in HCL provider blocks requirement, but the first is designed for another concern: Ephemeral values have restricted usable contexts such as provider configuration and write-only arguments; they are appropriate for transient tokens that must not be persisted; this behavior should be assessed against the concrete need to secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks. That first component is designed to omit short-lived input values from state and plan artifacts, which does not accomplish the requested task to secure resource attributes and possibly persisted secrets, even though the other measure satisfies avoid embedding long-lived credentials in HCL provider blocks.
B:The first measure is intended to prevent credentials from entering source history: 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 secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks. The second measure is intended to choose secrecy controls based on persistence as well as output redaction: 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 secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks. Neither is the directly designated method for the separate goals of secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks in this review.
D:The first measure meets the requirement to secure resource attributes and possibly persisted secrets, but its partner serves a different role: Vault provides secret-management and credential capabilities; its Terraform provider can integrate with Vault APIs, but ordinary read results may still be recorded unless ephemeral patterns are used; this behavior should be assessed against the concrete need to secure resource attributes and possibly persisted secrets and avoid embedding long-lived credentials in HCL provider blocks. That second component is designed to retrieve or distribute sensitive credentials under explicit access policy, so the still-missing criterion is to avoid embedding long-lived credentials in HCL provider blocks, while the first criterion remains secure resource attributes and possibly persisted secrets.
Question 453
An engineer is deciding whether Terraform should own an existing object. The team must both ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source. Which paired choice implements those distinct goals?
- Distinguish
locals from remote resource declarations + Reference data.aws_ami.base.id for a lookup
- Use an
ephemeral resource for supported temporary data + Reference data.aws_ami.base.id for a lookup
- Declare a managed object with
resource + Reference data.aws_ami.base.id for a lookup
- Declare a managed object with
resource + Select resource instead of data when deletion must be managed
- Query an existing object with
data + Keep a data lookup separate from a same-object managed declaration
Explanation
Correct Answer
C:For the first criterion, 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 ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source; this directly addresses the need to ask Terraform to own the lifecycle of a remote object. For the separate second criterion, the data. address prefix distinguishes a read-only lookup from a managed resource address; its value can feed managed resources without importing the looked-up object; this behavior should be assessed against the concrete need to ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source; this fulfills the need to use an attribute returned by a provider data source. Together they cover the independent tasks of ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the use an attribute returned by a provider data source requirement, but the first is designed for another concern: 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 ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source. That first component is designed to compute reusable expression results without creating an API object, which does not accomplish the requested task to ask Terraform to own the lifecycle of a remote object, even though the other measure satisfies use an attribute returned by a provider data source.
B:The second measure does meet the use an attribute returned by a provider data source requirement, but the first is designed for another concern: 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 ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source. That first component is designed to obtain a short-lived value without persisting it in state or plan, which does not accomplish the requested task to ask Terraform to own the lifecycle of a remote object, even though the other measure satisfies use an attribute returned by a provider data source.
D:The first measure meets the requirement to ask Terraform to own the lifecycle of a remote object, but its partner serves a different role: A data source never directs Terraform to delete the looked-up object; lifecycle ownership requires a managed declaration or an adopted resource; this behavior should be assessed against the concrete need to ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source. That second component is designed to make intentional destruction part of Terraform's lifecycle model, so the still-missing criterion is to use an attribute returned by a provider data source, while the first criterion remains ask Terraform to own the lifecycle of a remote object.
E:The first measure is intended to read an object without asking Terraform to create or manage it: 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 ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source. The second measure is intended to avoid mistaking two views of one API object for independent resources: A data source can read attributes but does not change who owns the underlying object; managing and reading one object need careful dependency design to avoid deferred or inconsistent reads; this behavior should be assessed against the concrete need to ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source. Neither is the directly designated method for the separate goals of ask Terraform to own the lifecycle of a remote object and use an attribute returned by a provider data source in this review.
Question 454
A Terraform review separates 2 requirements: (1) reject caller inputs that violate a Boolean rule; (2) avoid reading a root input directly from an unrelated child module. Identify the two features that each directly handle one of those requirements. Choose TWO.
- Recognize variable scope is per module
- Use
validation inside a variable block
- Pass values through
-var-file=custom.tfvars
- Define
output for a root result
- Mark a variable
sensitive = true
Explanation
Correct Answers
A: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 reject caller inputs that violate a Boolean rule and avoid reading a root input directly from an unrelated child module. This matches the distinct objective to avoid reading a root input directly from an unrelated child module; the remaining chosen features address reject caller inputs that violate a Boolean rule.
B: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 reject caller inputs that violate a Boolean rule and avoid reading a root input directly from an unrelated child module. This matches the distinct objective to reject caller inputs that violate a Boolean rule; the remaining chosen features address avoid reading a root input directly from an unrelated child module.
Incorrect Answers
C:Explicit variable files let separate runs use separate configurations; the file supplies module inputs, not resource lifecycle commands; this behavior should be assessed against the concrete need to reject caller inputs that violate a Boolean rule and avoid reading a root input directly from an unrelated child module. Its main application is to load named environment inputs that are not automatically discovered; the checklist instead asks for reject caller inputs that violate a Boolean rule; and avoid reading a root input directly from an unrelated child module. None of those distinct criteria specifically calls for this alternative.
D: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 reject caller inputs that violate a Boolean rule and avoid reading a root input directly from an unrelated child module. Its main application is to expose a selected computed value after provisioning; the checklist instead asks for reject caller inputs that violate a Boolean rule; and avoid reading a root input directly from an unrelated child module. None of those distinct criteria specifically calls for this alternative.
E:The mark affects display and propagation of sensitivity; ordinary sensitive values may still be persisted in state and saved plans; this behavior should be assessed against the concrete need to reject caller inputs that violate a Boolean rule and avoid reading a root input directly from an unrelated child module. Its main application is to suppress ordinary disclosure of a secret in Terraform output; the checklist instead asks for reject caller inputs that violate a Boolean rule; and avoid reading a root input directly from an unrelated child module. None of those distinct criteria specifically calls for this alternative.
Question 455
In an automated release, the requested result is to collect the same attribute from every list-like object. What should the engineer select?
- Use a splat expression
items[*].id
- Use
setproduct(a, b)
- Use a conditional
condition ? yes : no
- Use
alltrue(list_of_bools)
Explanation
Correct Answer
A: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. This directly supports the task to collect the same attribute from every list-like object during a module implementation.
Incorrect Answers
B: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. The stated requirement is to collect the same attribute from every list-like object, not to create every ordered combination across two input collections; this alternative addresses a different control or phase.
C:The conditional expression evaluates a condition to choose a result; its two result arms must have compatible types for Terraform to infer a usable value; this behavior should be assessed against the concrete need to collect the same attribute from every list-like object. That can be useful when the aim is to select between two expression results based on a Boolean test, but it does not directly deliver the requested ability to collect the same attribute from every list-like object.
D: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. The distinction matters here: using that mechanism to require every evaluated Boolean in a collection to be true would still leave the objective to collect the same attribute from every list-like object unmet.
Question 456
A Terraform review distinguishes lifecycle safeguards from graph edges. The team must both order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains. Which paired choice implements those distinct goals?
- Use
replace_triggered_by for resource change coupling + Use prevent_destroy = true on a configured resource
- Use
depends_on for a hidden dependency + Recognize propagated create_before_destroy behavior
- Avoid a circular dependency graph + Use
ignore_changes = [tags]
- Use
depends_on for a hidden dependency + Use prevent_destroy = true on a configured resource
Explanation
Correct Answer
D:For the first criterion, 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 order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains; this directly addresses the need to order operations even when no output attribute is consumed. For the separate second criterion, 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 order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains; this fulfills the need to fail a plan that would destroy the protected resource while its block remains. Together they cover the independent tasks of order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the fail a plan that would destroy the protected resource while its block remains requirement, but the first is designed for another concern: The rule ties replacement to planned actions on managed resources; plain local values do not themselves have planned resource actions; this behavior should be assessed against the concrete need to order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains. That first component is designed to replace a resource when another managed resource or attribute changes, which does not accomplish the requested task to order operations even when no output attribute is consumed, even though the other measure satisfies fail a plan that would destroy the protected resource while its block remains.
B:The first measure meets the requirement to order operations even when no output attribute is consumed, but its partner serves a different role: 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 order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains. That second component is designed to understand why a dependency may also be retained during a replacement, so the still-missing criterion is to fail a plan that would destroy the protected resource while its block remains, while the first criterion remains order operations even when no output attribute is consumed.
C:The first measure is intended to break mutual dependencies that prevent Terraform from ordering operations: Terraform cannot schedule a true cycle in its directed acyclic graph; rearranging references or splitting resource responsibilities can remove the cycle; this behavior should be assessed against the concrete need to order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains. The second measure is intended to exclude selected post-creation attribute differences from update planning: 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 order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains. Neither is the directly designated method for the separate goals of order operations even when no output attribute is consumed and fail a plan that would destroy the protected resource while its block remains in this review.
Question 457
A module needs configuration guardrails. Two independent changes are requested: first, reject a malformed module input with a custom message; second, verify an assumption before Terraform processes the target resource operation. Which pair of measures fulfills both?
- Use a
check block with assertions + Use a resource precondition
- Use a variable
validation block + Use a resource precondition
- Use
error_message for actionable custom diagnostics + Use alltrue over transformed entries
- Use a variable
validation block + Use can(regex(...)) in validation
Explanation
Correct Answer
B:For the first criterion, 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 reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation; this directly addresses the need to reject a malformed module input with a custom message. For the separate second criterion, a lifecycle precondition can inspect values needed for a safe operation; failure blocks proceeding instead of simply recording a health warning; this behavior should be assessed against the concrete need to reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation; this fulfills the need to verify an assumption before Terraform processes the target resource operation. Together they cover the independent tasks of reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the verify an assumption before Terraform processes the target resource operation requirement, but the first is designed for another concern: 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 reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation. That first component is designed to monitor an infrastructure invariant and report failed checks without blocking the whole operation, which does not accomplish the requested task to reject a malformed module input with a custom message, even though the other measure satisfies verify an assumption before Terraform processes the target resource operation.
C:The first measure is intended to tell users which contract failed and why: Variable validation and lifecycle conditions support custom messages; a vague error message makes troubleshooting harder even when the Boolean test is correct; this behavior should be assessed against the concrete need to reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation. The second measure is intended to validate every element of a collection against one rule: 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 reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation. Neither is the directly designated method for the separate goals of reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation in this review.
D:The first measure meets the requirement to reject a malformed module input with a custom message, but its partner serves a different role: Regex can raise an error when no match exists; can converts that evaluability into a Boolean; it makes a precise input-validation rule possible; this behavior should be assessed against the concrete need to reject a malformed module input with a custom message and verify an assumption before Terraform processes the target resource operation. That second component is designed to test a string against a pattern without crashing on a nonmatch, so the still-missing criterion is to verify an assumption before Terraform processes the target resource operation, while the first criterion remains reject a malformed module input with a custom message.
Question 458
A Terraform team is hardening secret management. A reviewer must determine how to reduce dependence on hardcoded long-lived API keys. Which action is the appropriate choice?
- Treat saved plan files as sensitive artifacts
- Protect access to remote state
- Use short-lived cloud identities for automation
- Use HCP Terraform sensitive workspace variables
Explanation
Correct Answer
C:Dynamic provider credentials or workload federation can issue bounded run-specific authorization; this limits blast radius while still requiring correct API permissions; this behavior should be assessed against the concrete need to reduce dependence on hardcoded long-lived API keys. This directly supports the task to reduce dependence on hardcoded long-lived API keys during a cross-team handoff.
Incorrect Answers
A: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 reduce dependence on hardcoded long-lived API keys. The stated requirement is to reduce dependence on hardcoded long-lived API keys, not to avoid leaking inputs and backend information through CI downloads; this alternative addresses a different control or phase.
B: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 reduce dependence on hardcoded long-lived API keys. That can be useful when the aim is to secure resource attributes and possibly persisted secrets, but it does not directly deliver the requested ability to reduce dependence on hardcoded long-lived API keys.
D: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 reduce dependence on hardcoded long-lived API keys. It may support a related workflow, but the question specifically requires the mechanism for reduce dependence on hardcoded long-lived API keys rather than restrict display of secret input values in hosted runs.
Question 459
During a deployment checklist, the team must accomplish all of these distinct aims: (1) automatically load documented variable files in a root module; (2) suppress ordinary disclosure of a secret in Terraform output. Select exactly the two relevant mechanisms. Choose TWO.
- Use
terraform.tfvars or *.auto.tfvars
- Mark a variable
sensitive = true
- Define
output for a root result
- Pass values through
-var-file=custom.tfvars
- Use
terraform output -raw NAME for a string result
Explanation
Correct Answers
A: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 automatically load documented variable files in a root module and suppress ordinary disclosure of a secret in Terraform output. This matches the distinct objective to automatically load documented variable files in a root module; the remaining chosen features address suppress ordinary disclosure of a secret in Terraform output.
B:The mark affects display and propagation of sensitivity; ordinary sensitive values may still be persisted in state and saved plans; this behavior should be assessed against the concrete need to automatically load documented variable files in a root module and suppress ordinary disclosure of a secret in Terraform output. This matches the distinct objective to suppress ordinary disclosure of a secret in Terraform output; the remaining chosen features address automatically load documented variable files in a root module.
Incorrect Answers
C:Outputs provide a documented interface for command output and automation; they can be inspected with terraform output when recorded in state; this behavior should be assessed against the concrete need to automatically load documented variable files in a root module and suppress ordinary disclosure of a secret in Terraform output. Its main application is to expose a selected computed value after provisioning; the checklist instead asks for automatically load documented variable files in a root module; and suppress ordinary disclosure of a secret in Terraform output. None of those distinct criteria specifically calls for this alternative.
D:Explicit variable files let separate runs use separate configurations; the file supplies module inputs, not resource lifecycle commands; this behavior should be assessed against the concrete need to automatically load documented variable files in a root module and suppress ordinary disclosure of a secret in Terraform output. Its main application is to load named environment inputs that are not automatically discovered; the checklist instead asks for automatically load documented variable files in a root module; and suppress ordinary disclosure of a secret in Terraform output. None of those distinct criteria specifically calls for this alternative.
E:Raw output formats a supported string, number, or Boolean directly without extra Terraform representation; complex objects require another output format; this behavior should be assessed against the concrete need to automatically load documented variable files in a root module and suppress ordinary disclosure of a secret in Terraform output. Its main application is to retrieve a plain scalar output for shell integration; the checklist instead asks for automatically load documented variable files in a root module; and suppress ordinary disclosure of a secret in Terraform output. None of those distinct criteria specifically calls for this alternative.
Question 460
A reviewer is assessing Terraform built-in functions and generated nested blocks. The team must both exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection. Which paired choice implements those distinct goals?
- Add
if to a for expression + Use a dynamic block to generate nested blocks
- Add
if to a for expression + Use ... in a grouped object for expression
- Use
join(delimiter, list) + Use file(path) to read local text
- Use
zipmap(keys, values) + Use a dynamic block to generate nested blocks
Explanation
Correct Answer
A:For the first criterion, filtering occurs while constructing the new collection; it is different from count, which controls the number of resource instances; this behavior should be assessed against the concrete need to exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection; this directly addresses the need to exclude source elements that do not meet a condition. For the separate second criterion, dynamic blocks create nested configuration blocks, not top-level resources or meta-argument blocks; iteration can use for_each inside the dynamic block; this behavior should be assessed against the concrete need to exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection; this fulfills the need to repeat provider-specific nested blocks from a collection. Together they cover the independent tasks of exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection without exchanging the responsibilities of these features.
Incorrect Answers
B:The first measure meets the requirement to exclude source elements that do not meet a condition, but its partner serves a different role: 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 exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection. That second component is designed to collect duplicate output keys into lists instead of reporting collisions, so the still-missing criterion is to repeat provider-specific nested blocks from a collection, while the first criterion remains exclude source elements that do not meet a condition.
C:The first measure is intended to combine a sequence of strings with a separator: Join forms one string from elements; split performs the reverse direction on a string; this behavior should be assessed against the concrete need to exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection. The second measure is intended to obtain existing UTF-8 file contents during expression evaluation: 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 exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection. Neither is the directly designated method for the separate goals of exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection in this review.
D:The second measure does meet the repeat provider-specific nested blocks from a collection requirement, but the first is designed for another concern: 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 exclude source elements that do not meet a condition and repeat provider-specific nested blocks from a collection. That first component is designed to assemble a map from paired key and value lists, which does not accomplish the requested task to exclude source elements that do not meet a condition, even though the other measure satisfies repeat provider-specific nested blocks from a collection.