Question 370
A Terraform rollout has separate acceptance criteria: avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics. Which combined approach directly satisfies the two criteria?
- Use an attribute reference for an implicit edge + Use
replace_triggered_by rather than depends_on for forced rebuilding
- Recognize lifecycle arguments are evaluated early + Use
create_before_destroy = true
- Use
terraform_data for value-driven replacement triggers + Use explicit dependencies on module calls carefully
- Recognize lifecycle arguments are evaluated early + Use
replace_triggered_by rather than depends_on for forced rebuilding
- Use
ignore_changes = [tags] + Use replace_triggered_by rather than depends_on for forced rebuilding
Explanation
Correct Answer
D:For the first criterion, 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 avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics; this directly addresses the need to avoid dynamic expressions for create_before_destroy and similar rules. For the separate second criterion, a dependency establishes when work runs; it does not by itself demand a replacement of an unchanged dependent object; this behavior should be assessed against the concrete need to avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics; this fulfills the need to differentiate operation ordering from replacement semantics. Together they cover the independent tasks of avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the differentiate operation ordering from replacement semantics requirement, but the first is designed for another concern: 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 avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics. That first component is designed to order resources when the second consumes a value from the first, which does not accomplish the requested task to avoid dynamic expressions for create_before_destroy and similar rules, even though the other measure satisfies differentiate operation ordering from replacement semantics.
B:The first measure meets the requirement to avoid dynamic expressions for create_before_destroy and similar rules, but its partner serves a different role: This lifecycle rule can reduce service interruption where unique names and quotas allow coexistence; it cannot guarantee an API permits two simultaneous objects; this behavior should be assessed against the concrete need to avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics. That second component is designed to request creation of a replacement before deleting the old instance, so the still-missing criterion is to differentiate operation ordering from replacement semantics, while the first criterion remains avoid dynamic expressions for create_before_destroy and similar rules.
C:The first measure is intended to represent an input change through a managed resource lifecycle: 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 avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics. The second measure is intended to delay all operations in a child module until required prerequisites complete: 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 avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics. Neither is the directly designated method for the separate goals of avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics in this review.
E:The second measure does meet the differentiate operation ordering from replacement semantics 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 avoid dynamic expressions for create_before_destroy and similar rules and differentiate operation ordering from replacement semantics. That first component is designed to exclude selected post-creation attribute differences from update planning, which does not accomplish the requested task to avoid dynamic expressions for create_before_destroy and similar rules, even though the other measure satisfies differentiate operation ordering from replacement semantics.
Question 371
A deployment must validate assumptions or outcomes. The team must both validate every element of a collection against one rule and test a guarantee only after the remote result is known. Which paired choice implements those distinct goals?
- Use a precondition rather than a check for an unsafe prerequisite + Use
try for optional nested values
- Use
alltrue over transformed entries + Use a postcondition for a provider-computed result
- Use
assert { condition = ... } inside check + Use a postcondition for a provider-computed result
- Use a variable
validation block + Use a postcondition for a provider-computed result
- Use
alltrue over transformed entries + Use a resource precondition
Explanation
Correct Answer
B:For the first 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 validate every element of a collection against one rule and test a guarantee only after the remote result is known; this directly addresses the need to validate every element of a collection against one rule. For the separate second criterion, a computed attribute might be unknown during planning; postconditions evaluate when sufficient data exists, rather than fabricating a preliminary value; this behavior should be assessed against the concrete need to validate every element of a collection against one rule and test a guarantee only after the remote result is known; this fulfills the need to test a guarantee only after the remote result is known. Together they cover the independent tasks of validate every element of a collection against one rule and test a guarantee only after the remote result is known without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure is intended to stop a deployment when a required assumption fails: Blocking conditions are appropriate when continuing could create invalid infrastructure; a check block typically reports a warning and lets operations proceed; this behavior should be assessed against the concrete need to validate every element of a collection against one rule and test a guarantee only after the remote result is known. The second measure is intended to provide a fallback when a dynamic attribute path is absent: 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 validate every element of a collection against one rule and test a guarantee only after the remote result is known. Neither is the directly designated method for the separate goals of validate every element of a collection against one rule and test a guarantee only after the remote result is known in this review.
C:The second measure does meet the test a guarantee only after the remote result is known requirement, but the first is designed for another concern: 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 validate every element of a collection against one rule and test a guarantee only after the remote result is known. That first component is designed to express the Boolean invariant and its diagnostic message, which does not accomplish the requested task to validate every element of a collection against one rule, even though the other measure satisfies test a guarantee only after the remote result is known.
D:The second measure does meet the test a guarantee only after the remote result is known requirement, but the first is designed for another concern: 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 validate every element of a collection against one rule and test a guarantee only after the remote result is known. That first component is designed to reject a malformed module input with a custom message, which does not accomplish the requested task to validate every element of a collection against one rule, even though the other measure satisfies test a guarantee only after the remote result is known.
E:The first measure meets the requirement to validate every element of a collection against one rule, but its partner serves a different role: 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 validate every element of a collection against one rule and test a guarantee only after the remote result is known. That second component is designed to verify an assumption before Terraform processes the target resource operation, so the still-missing criterion is to test a guarantee only after the remote result is known, while the first criterion remains validate every element of a collection against one rule.
Question 372
A reviewer is comparing redaction, ephemeral values, and state protection. The requirement is to avoid embedding long-lived credentials in HCL provider blocks. Which Terraform mechanism directly meets this requirement?
- Use environment-based provider authentication when supported
- Use an
ephemeral resource to retrieve supported temporary secrets
- Mark a variable
sensitive = true
- Rotate credentials after suspected disclosure
- Treat saved plan files as sensitive artifacts
- Protect access to remote state
Explanation
Correct Answer
A: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 avoid embedding long-lived credentials in HCL provider blocks. This directly supports the task to avoid embedding long-lived credentials in HCL provider blocks during a planned migration.
Incorrect Answers
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 avoid embedding long-lived credentials in HCL provider blocks. The distinction matters here: using that mechanism to obtain runtime-only data through an ephemeral provider operation would still leave the objective to avoid embedding long-lived credentials in HCL provider blocks unmet.
C:Sensitivity propagates through expressions and hides values in many UI contexts; it does not, by itself, keep the original secret out of state or saved plan files; this behavior should be assessed against the concrete need to avoid embedding long-lived credentials in HCL provider blocks. It may support a related workflow, but the question specifically requires the mechanism for avoid embedding long-lived credentials in HCL provider blocks rather than hide a secret from ordinary CLI displays.
D:Removing a line from code does not revoke already exposed tokens; credential rotation and cleanup of historical artifacts are separate security steps; this behavior should be assessed against the concrete need to avoid embedding long-lived credentials in HCL provider blocks. The stated requirement is to avoid embedding long-lived credentials in HCL provider blocks, not to reduce risk when secrets were written to state or repository history; this alternative addresses a different control or phase.
E: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 avoid embedding long-lived credentials in HCL provider blocks. That can be useful when the aim is to avoid leaking inputs and backend information through CI downloads, but it does not directly deliver the requested ability to avoid embedding long-lived credentials in HCL provider blocks.
F: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 avoid embedding long-lived credentials in HCL provider blocks. The distinction matters here: using that mechanism to secure resource attributes and possibly persisted secrets would still leave the objective to avoid embedding long-lived credentials in HCL provider blocks unmet.
Question 373
An engineer needs to obtain a short-lived value without persisting it in state or plan as part of a planned migration. Which option is the best fit?
- Use a resource block together with an
import block
- Select
resource instead of data when deletion must be managed
- Reference
data.aws_ami.base.id for a lookup
- Use an
ephemeral resource for supported temporary data
Explanation
Correct Answer
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 obtain a short-lived value without persisting it in state or plan. This directly supports the task to obtain a short-lived value without persisting it in state or plan during a maintenance request.
Incorrect Answers
A:Import associates the provider's existing remote object with a declared resource address; simply reading it as a data source does not establish that lifecycle ownership; this behavior should be assessed against the concrete need to obtain a short-lived value without persisting it in state or plan. That can be useful when the aim is to adopt a previously existing object into Terraform management, but it does not directly deliver the requested ability to obtain a short-lived value without persisting it in state or plan.
B: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 obtain a short-lived value without persisting it in state or plan. The distinction matters here: using that mechanism to make intentional destruction part of Terraform's lifecycle model would still leave the objective to obtain a short-lived value without persisting it in state or plan unmet.
C: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 obtain a short-lived value without persisting it in state or plan. It may support a related workflow, but the question specifically requires the mechanism for obtain a short-lived value without persisting it in state or plan rather than use an attribute returned by a provider data source.
Question 374
A configuration connects network and compute resources. Two independent changes are requested: first, extract values from instances created with for_each; second, declare a relationship that cannot be expressed through an input attribute. Which pair of measures fulfills both?
- Use
output to expose child internals intentionally + Use depends_on for hidden ordering requirements
- Use a
for expression over a resource map + Use depends_on for hidden ordering requirements
- Use
resource.items[*].id for counted instances + Use resource_type.name.attribute
- Use a
for expression over a resource map + Use local.prefix
Explanation
Correct Answer
B:For the first criterion, 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 and declare a relationship that cannot be expressed through an input attribute; this directly addresses the need to extract values from instances created with for_each. For the separate second criterion, 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 extract values from instances created with for_each and declare a relationship that cannot be expressed through an input attribute; this fulfills the need to declare a relationship that cannot be expressed through an input attribute. Together they cover the independent tasks of extract values from instances created with for_each and declare a relationship that cannot be expressed through an input attribute without exchanging the responsibilities of these features.
Incorrect Answers
A:The second measure does meet the declare a relationship that cannot be expressed through an input attribute requirement, but the first is designed for another concern: 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 and declare a relationship that cannot be expressed through an input attribute. That first component is designed to create a stable boundary for modules that callers depend on, which does not accomplish the requested task to extract values from instances created with for_each, even though the other measure satisfies declare a relationship that cannot be expressed through an input attribute.
C:The first measure is intended to collect an attribute from a list-like collection of resource instances: Splat expressions iterate list, set, or tuple values, including count-created instances. for_each maps are normally traversed using a for expression; this behavior should be assessed against the concrete need to extract values from instances created with for_each and declare a relationship that cannot be expressed through an input attribute. The second measure is intended to read a named attribute from a managed resource: The expression resolves through the address and provider schema; terraform sees the dependency and can wait for an unknown computed value until apply; this behavior should be assessed against the concrete need to extract values from instances created with for_each and declare a relationship that cannot be expressed through an input attribute. Neither is the directly designated method for the separate goals of extract values from instances created with for_each and declare a relationship that cannot be expressed through an input attribute in this review.
D:The first measure meets the requirement to extract values from instances created with for_each, 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 extract values from instances created with for_each and declare a relationship that cannot be expressed through an input attribute. That second component is designed to reference a computed local value in the same module, so the still-missing criterion is to declare a relationship that cannot be expressed through an input attribute, while the first criterion remains extract values from instances created with for_each.
Question 375
During a deployment checklist, one task is to expose a selected computed value after provisioning, while another is to transfer computed values from a child module to its caller. Select the matching pair of techniques.
- Define
output for a root result + Use validation inside a variable block
- Define
output for a root result + Use a child-module output as module.app.endpoint
- Use
terraform output -raw NAME for a string result + Use a child-module output as module.app.endpoint
- Mark a variable
sensitive = true + Mark an input variable ephemeral = true
Explanation
Correct Answer
B:For the first criterion, 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 expose a selected computed value after provisioning and transfer computed values from a child module to its caller; this directly addresses the need to expose a selected computed value after provisioning. For the separate second 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 expose a selected computed value after provisioning and transfer computed values from a child module to its caller; this fulfills the need to transfer computed values from a child module to its caller. Together they cover the independent tasks of expose a selected computed value after provisioning and transfer computed values from a child module to its caller without exchanging the responsibilities of these features.
Incorrect Answers
A:The first measure meets the requirement to expose a selected computed value after provisioning, 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 expose a selected computed value after provisioning and transfer computed values from a child module to its caller. That second component is designed to reject caller inputs that violate a Boolean rule, so the still-missing criterion is to transfer computed values from a child module to its caller, while the first criterion remains expose a selected computed value after provisioning.
C:The second measure does meet the transfer computed values from a child module to its caller requirement, but the first is designed for another concern: 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 expose a selected computed value after provisioning and transfer computed values from a child module to its caller. That first component is designed to retrieve a plain scalar output for shell integration, which does not accomplish the requested task to expose a selected computed value after provisioning, even though the other measure satisfies transfer computed values from a child module to its caller.
D:The first measure is intended to suppress ordinary disclosure of a secret in Terraform output: 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 expose a selected computed value after provisioning and transfer computed values from a child module to its caller. The second measure is intended to prevent a temporary secret from being persisted to state and plan files: 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 expose a selected computed value after provisioning and transfer computed values from a child module to its caller. Neither is the directly designated method for the separate goals of expose a selected computed value after provisioning and transfer computed values from a child module to its caller in this review.
Question 376
The immediate Terraform task is to enforce uniqueness without relying on list positions. Which method handles that task most directly?
- Convert values with
tolist(...)
- Convert values with
toset(...)
- Use
set(string) for unique unordered strings
- Use
optional(...) in object attributes
Explanation
Correct Answer
C:Sets discard duplicate elements and are not an ordered sequence; this changes instance-key considerations if used with for_each; this behavior should be assessed against the concrete need to enforce uniqueness without relying on list positions. This directly supports the task to enforce uniqueness without relying on list positions during a configuration change.
Incorrect Answers
A: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 enforce uniqueness without relying on list positions. The distinction matters here: using that mechanism to produce a list value when a downstream expression requires list semantics would still leave the objective to enforce uniqueness without relying on list positions unmet.
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 enforce uniqueness without relying on list positions. It may support a related workflow, but the question specifically requires the mechanism for enforce uniqueness without relying on list positions rather than remove duplicates and produce set semantics for iteration.
D: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 enforce uniqueness without relying on list positions. That can be useful when the aim is to allow an object field to be omitted from a typed input, but it does not directly deliver the requested ability to enforce uniqueness without relying on list positions.
Question 377
In an automated release, the requested result is to collect duplicate output keys into lists instead of reporting collisions. What should the engineer select?
- Use
cidrsubnet(prefix, newbits, netnum)
- Use
zipmap(keys, values)
- Use
... in a grouped object for expression
- Use
split(delimiter, string)
Explanation
Correct Answer
C: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 duplicate output keys into lists instead of reporting collisions. This directly supports the task to collect duplicate output keys into lists instead of reporting collisions during a module implementation.
Incorrect Answers
A: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 collect duplicate output keys into lists instead of reporting collisions. That can be useful when the aim is to derive a smaller subnet CIDR from a parent prefix, but it does not directly deliver the requested ability to collect duplicate output keys into lists instead of reporting collisions.
B: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 collect duplicate output keys into lists instead of reporting collisions. The distinction matters here: using that mechanism to assemble a map from paired key and value lists would still leave the objective to collect duplicate output keys into lists instead of reporting collisions unmet.
D: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 collect duplicate output keys into lists instead of reporting collisions. The stated requirement is to collect duplicate output keys into lists instead of reporting collisions, not to divide text into a list around a separator; this alternative addresses a different control or phase.
Question 378
An engineer needs to differentiate operation ordering from replacement semantics as part of an automated release. Which option is the best fit?
- Use explicit dependencies on module calls carefully
- Use
replace_triggered_by for resource change coupling
- Use graph parallelism for independent resources
- Use
replace_triggered_by rather than depends_on for forced rebuilding
- Recognize propagated
create_before_destroy behavior
Explanation
Correct Answer
D:A dependency establishes when work runs; it does not by itself demand a replacement of an unchanged dependent object; this behavior should be assessed against the concrete need to differentiate operation ordering from replacement semantics. This directly supports the task to differentiate operation ordering from replacement semantics during an infrastructure audit.
Incorrect Answers
A: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 differentiate operation ordering from replacement semantics. The stated requirement is to differentiate operation ordering from replacement semantics, not to delay all operations in a child module until required prerequisites complete; this alternative addresses a different control or phase.
B: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 differentiate operation ordering from replacement semantics. That can be useful when the aim is to replace a resource when another managed resource or attribute changes, but it does not directly deliver the requested ability to differentiate operation ordering from replacement semantics.
C: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 differentiate operation ordering from replacement semantics. The distinction matters here: using that mechanism to allow unrelated operations to proceed concurrently would still leave the objective to differentiate operation ordering from replacement semantics unmet.
E: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 differentiate operation ordering from replacement semantics. The stated requirement is to differentiate operation ordering from replacement semantics, not to understand why a dependency may also be retained during a replacement; this alternative addresses a different control or phase.
Question 379
An operator is choosing between variable validation and ongoing health checks. The requirement is to verify a property after the relevant resource or data evaluation. Which Terraform mechanism directly meets this requirement?
- Use
can(regex(...)) in validation
- Use a
check block with assertions
- Use an output
precondition
- Use a resource
postcondition
- Use
alltrue over transformed entries
Explanation
Correct Answer
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 verify a property after the relevant resource or data evaluation. This directly supports the task to verify a property after the relevant resource or data evaluation during a planned migration.
Incorrect Answers
A: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 verify a property after the relevant resource or data evaluation. It may support a related workflow, but the question specifically requires the mechanism for verify a property after the relevant resource or data evaluation rather than test a string against a pattern without crashing on a nonmatch.
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 verify a property after the relevant resource or data evaluation. The stated requirement is to verify a property after the relevant resource or data evaluation, not to monitor an infrastructure invariant and report failed checks without blocking the whole operation; this alternative addresses a different control or phase.
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 verify a property after the relevant resource or data evaluation. That can be useful when the aim is to ensure a module only exposes results that satisfy a contract, but it does not directly deliver the requested ability to verify a property after the relevant resource or data evaluation.
E:Combining a for expression with alltrue yields a single Boolean input contract; it is not the same as testing only the first list element; this behavior should be assessed against the concrete need to verify a property after the relevant resource or data evaluation. It may support a related workflow, but the question specifically requires the mechanism for verify a property after the relevant resource or data evaluation rather than validate every element of a collection against one rule.
Question 380
An infrastructure repository handles database passwords and tokens. A reviewer must determine how to avoid leaking inputs and backend information through CI downloads. Which action is the appropriate choice?
- Use short-lived cloud identities for automation
- Avoid unnecessary
nonsensitive(...) calls
- Distinguish
ephemeral from sensitive
- Mark a secret root output
sensitive = true
- Treat saved plan files as sensitive artifacts
Explanation
Correct Answer
E: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 avoid leaking inputs and backend information through CI downloads. This directly supports the task to avoid leaking inputs and backend information through CI downloads during a cross-team handoff.
Incorrect Answers
A: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 avoid leaking inputs and backend information through CI downloads. The distinction matters here: using that mechanism to reduce dependence on hardcoded long-lived API keys would still leave the objective to avoid leaking inputs and backend information through CI downloads unmet.
B: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 avoid leaking inputs and backend information through CI downloads. It may support a related workflow, but the question specifically requires the mechanism for avoid leaking inputs and backend information through CI downloads rather than preserve Terraform's safety indicator for secret-bearing expressions.
C:Sensitive marks affect presentation; ephemeral marks constrain persistence and permitted expression contexts; they solve related but nonidentical problems; this behavior should be assessed against the concrete need to avoid leaking inputs and backend information through CI downloads. The stated requirement is to avoid leaking inputs and backend information through CI downloads, not to choose secrecy controls based on persistence as well as output redaction; this alternative addresses a different control or phase.
D: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 avoid leaking inputs and backend information through CI downloads. That can be useful when the aim is to avoid normal display of an output carrying sensitive data, but it does not directly deliver the requested ability to avoid leaking inputs and backend information through CI downloads.