Question 90
An engineering checklist calls for separate outcomes: (1) make a CI formatting gate detect source files that need formatting; (2) tie an approved infrastructure change to a reviewed commit. Which TWO options implement the requested outcomes? Choose TWO.
- Formatting versus validation
- terraform fmt -diff
- terraform fmt -check
- Keep configuration in version control
- Review a plan before apply
- Write configuration first
Explanation
Correct Answers
C:Check mode verifies formatting and returns a failure when changes would be required instead of writing edited files; this meets the requirement to make a CI formatting gate detect source files that need formatting, while the other selected techniques address tie an approved infrastructure change to a reviewed commit, which require their own distinct Terraform mechanisms.
D:Committing root module files allows the team to relate plans and runs to a specific version of intended infrastructure; this meets the requirement to tie an approved infrastructure change to a reviewed commit, while the other selected techniques address make a CI formatting gate detect source files that need formatting, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:terraform fmt addresses canonical HCL layout while terraform validate checks whether the configuration is structurally acceptable; it addresses distinguish style-only issues from Terraform type and schema errors, but this delivery instead requires make a CI formatting gate detect source files that need formatting and tie an approved infrastructure change to a reviewed commit. The required combination involves Keep configuration in version control and terraform fmt -check, not the behavior of Formatting versus validation.
B:The diff switch displays textual differences between current file formatting and the canonical formatting result; it addresses show which HCL formatting edits Terraform would make, but this delivery instead requires make a CI formatting gate detect source files that need formatting and tie an approved infrastructure change to a reviewed commit. The required combination involves Keep configuration in version control and terraform fmt -check, not the behavior of terraform fmt -diff.
E:The plan stage compares desired configuration with observed resource state and shows the proposed operations for review; this concerns the task to inspect predicted create, update and delete actions prior to making changes, not the current need to tie an approved infrastructure change to a reviewed commit and the independent requirement to make a CI formatting gate detect source files that need formatting. A Keep configuration in version control approach is appropriate here; the substituted Review a plan before apply option does not supply the specified Terraform capability and the independent requirement to make a CI formatting gate detect source files that need formatting.
F:The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage; it addresses express the intended infrastructure before asking Terraform for a plan, but this delivery instead requires make a CI formatting gate detect source files that need formatting and tie an approved infrastructure change to a reviewed commit. The required combination involves Keep configuration in version control and terraform fmt -check, not the behavior of Write configuration first.
Question 91
During a design review, the requirement is to convert a delimiter-separated string into a list. Which option should the engineer select?
- The file function
- The ternary conditional operator
- The cidrsubnet function
- The split function
Explanation
Correct Answer
D:split divides a string at a delimiter and returns its constituent substrings; this directly meets the requirement to convert a delimiter-separated string into a list. By comparison, the cidrsubnet function is intended to calculate a nested network prefix from a parent CIDR range, which is a different task from convert a delimiter-separated string into a list.
Incorrect Answers
A:file reads existing local text; it does not wait for a provisioner to create the file during apply; this mechanism is useful when the job is to read UTF-8 content already present in a local file during evaluation, whereas the current scenario requires the engineer to convert a delimiter-separated string into a list. These operations have different effects in the stated Terraform workflow.
B:The condition ? value_a : value_b expression chooses a suitable branch without creating duplicate resource blocks; this mechanism is useful when the job is to set a resource argument according to a boolean expression, whereas the current scenario requires the engineer to convert a delimiter-separated string into a list. These operations have different effects in the stated Terraform workflow.
C:cidrsubnet derives a subnet CIDR using additional prefix bits and a network number, without provisioning a network resource; this mechanism is useful when the job is to calculate a nested network prefix from a parent CIDR range, whereas the current scenario requires the engineer to convert a delimiter-separated string into a list. These operations have different effects in the stated Terraform workflow.
Question 92
A Terraform module author needs to reject a design that tries to publish a runtime-only value through the root output table. Which feature or operation is the most direct match?
- Not treating Base64 as secrecy
- Preventing credential leaks in plans
- Vault-backed secret retrieval
- No ephemeral root output
Explanation
Correct Answer
D:Terraform does not permit ephemeral = true on root-module output blocks, because their ordinary purpose is persistent presentation; this directly meets the requirement to reject a design that tries to publish a runtime-only value through the root output table. By comparison, not treating Base64 as secrecy is intended to recognize that an encoded password remains sensitive information, which is a different task from reject a design that tries to publish a runtime-only value through the root output table.
Incorrect Answers
A:Base64 is reversible encoding; exposing encoded credentials in configuration or state still risks disclosure; this mechanism is useful when the job is to recognize that an encoded password remains sensitive information, whereas the current scenario requires the engineer to reject a design that tries to publish a runtime-only value through the root output table. These operations have different effects in the stated Terraform workflow.
B:Saved plan files may contain sensitive values and must be handled as confidential artifacts rather than safe public summaries; this mechanism is useful when the job is to avoid sharing a plan artifact publicly just because console values appear redacted, whereas the current scenario requires the engineer to reject a design that tries to publish a runtime-only value through the root output table. These operations have different effects in the stated Terraform workflow.
C:Vault can centralize secret lifecycle, policies and auditability, but provider and state-handling choices still determine whether a retrieved value is persisted; this mechanism is useful when the job is to retrieve an operational credential from a dedicated secret manager rather than committing it, whereas the current scenario requires the engineer to reject a design that tries to publish a runtime-only value through the root output table. These operations have different effects in the stated Terraform workflow.
Question 93
An engineer proposes “A registry module version constraint” to install a newly allowed child module release after editing its version requirement. Which outcome does the proposed technique actually provide?
- Changing a module source or version constraint requires reinitializing to resolve the updated selection.
- The module version argument accepts version constraints for registry sources and Terraform resolves compatible published releases during init.
- A module version ~> 2.1.0 permits 2.1.x releases but excludes 2.2.0 and later.
- Provider versions are constrained in required_providers and locked in .terraform.lock.hcl; registry modules use their module block version arguments.
Explanation
Correct Answer
B:A registry module version constraint is used when an operator needs to select a supported module release range from the registry. Consequently, this choice cannot meet the separate requirement to install a newly allowed child module release after editing its version requirement. The intended action would instead require Init after module version change.
Incorrect Answers
A:That outcome belongs to Init after module version change, the mechanism that can install a newly allowed child module release after editing its version requirement. The question concerns the engineer’s actual proposal, A registry module version constraint; it is directed at select a supported module release range from the registry, not that result.
C:This behavior belongs to A pessimistic module version constraint, which helps engineers allow compatible patch updates within a module's minor release series rather than satisfying the separate requirement to install a newly allowed child module release after editing its version requirement. The attempted technique was A registry module version constraint; it would instead be used to select a supported module release range from the registry, not to produce the effect associated with A pessimistic module version constraint.
D:This behavior belongs to Provider and module version separation, which helps engineers avoid confusing provider plugin selection with reusable module source selection rather than satisfying the separate requirement to install a newly allowed child module release after editing its version requirement. The attempted technique was A registry module version constraint; it would instead be used to select a supported module release range from the registry, not to produce the effect associated with Provider and module version separation.
Question 94
During a design review, the requirement is to use a child module's published value in a parent resource. Which option should the engineer select?
- A module output reference
- Explicit depends_on
- The resource address format
- An implicit attribute dependency
Explanation
Correct Answer
A:Parent configurations access child outputs using module.CHILD.OUTPUT; private child resource addresses are not automatically exported; this directly meets the requirement to use a child module's published value in a parent resource. By comparison, the resource address format is intended to identify a resource instance by its type and local name, which is a different task from use a child module's published value in a parent resource.
Incorrect Answers
B:The depends_on meta-argument adds dependency edges for a known relationship that Terraform cannot otherwise infer; this mechanism is useful when the job is to order resources when there is a dependency not expressed by attribute references, whereas the current scenario requires the engineer to use a child module's published value in a parent resource. These operations have different effects in the stated Terraform workflow.
C:A resource address inside a module ordinarily uses TYPE.NAME, with optional instance indexing when count or for_each is used; this mechanism is useful when the job is to identify a resource instance by its type and local name, whereas the current scenario requires the engineer to use a child module's published value in a parent resource. These operations have different effects in the stated Terraform workflow.
D:Referencing another managed resource's attribute creates an implicit dependency in Terraform's graph; this mechanism is useful when the job is to ensure a dependent resource waits for the object whose ID it needs, whereas the current scenario requires the engineer to use a child module's published value in a parent resource. These operations have different effects in the stated Terraform workflow.
Question 95
The team evaluates “terraform plan -target” for a requirement to limit a recovery-oriented plan to a resource and its dependencies. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- In human-readable plan diffs, ~ indicates that Terraform proposes updating existing resource attributes.
- In human-readable plans, - denotes a planned destruction of a managed resource.
- Targeting narrows planning scope and can miss other required changes, so it is not the normal long-term workflow.
- The graph command emits a DOT graph representation of Terraform dependencies, useful for spotting unexpected ordering constraints.
- Detailed exit codes are 0 for no diff, 2 for a nonempty successful plan and 1 for an error.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to limit a recovery-oriented plan to a resource and its dependencies, so it produces the behavior described. In contrast, a resource action marked minus serves a different goal: interpret a plan showing a resource that Terraform will destroy, not limit a recovery-oriented plan to a resource and its dependencies.
Incorrect Answers
A:The description applies to a resource action marked tilde when an engineer needs to identify an in-place change rather than object recreation; the named terraform plan -target instead handles the requirement to limit a recovery-oriented plan to a resource and its dependencies, so this behavior does not describe terraform plan -target in the situation named.
B:The description applies to a resource action marked minus when an engineer needs to interpret a plan showing a resource that Terraform will destroy; the named terraform plan -target instead handles the requirement to limit a recovery-oriented plan to a resource and its dependencies, so this behavior does not describe terraform plan -target in the situation named.
D:The description applies to terraform graph when an engineer needs to display configuration and state dependencies for troubleshooting; the named terraform plan -target instead handles the requirement to limit a recovery-oriented plan to a resource and its dependencies, so this behavior does not describe terraform plan -target in the situation named.
E:The description applies to terraform plan -detailed-exitcode when an engineer needs to distinguish no changes from proposed changes in automation; the named terraform plan -target instead handles the requirement to limit a recovery-oriented plan to a resource and its dependencies, so this behavior does not describe terraform plan -target in the situation named.
Question 96
During an infrastructure design review about how to fetch newer module releases permitted by version constraints, a maintainer asks what “terraform init -upgrade for modules” does. Which description is accurate?
- Upgrade tells init to reconsider prior module selections instead of simply reusing previously installed versions.
- Initialization installs required providers and modules and establishes the working directory's backend configuration.
- Terraform creates .terraform for module caches, provider installations and backend/workspace metadata; it is not a substitute for committed configuration.
- terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to fetch newer module releases permitted by version constraints, so it produces the behavior described. In contrast, repeatable initialization serves a different goal: run initialization again in an already prepared directory without unnecessary changes, not fetch newer module releases permitted by version constraints.
Incorrect Answers
B:The description applies to terraform init for a new directory when an engineer needs to prepare a folder containing fresh .tf configuration files; the named terraform init -upgrade for modules instead handles the requirement to fetch newer module releases permitted by version constraints, so this behavior does not describe terraform init -upgrade for modules in the situation named.
C:The description applies to the .terraform directory when an engineer needs to identify where a working directory keeps installed modules and initialization metadata; the named terraform init -upgrade for modules instead handles the requirement to fetch newer module releases permitted by version constraints, so this behavior does not describe terraform init -upgrade for modules in the situation named.
D:The description applies to repeatable initialization when an engineer needs to run initialization again in an already prepared directory without unnecessary changes; the named terraform init -upgrade for modules instead handles the requirement to fetch newer module releases permitted by version constraints, so this behavior does not describe terraform init -upgrade for modules in the situation named.
Question 97
During an infrastructure design review about how to format each element of multiple lists using one common template, a maintainer asks what “The formatlist function” does. Which description is accurate?
- formatlist applies its formatting string across list elements to produce a list of formatted strings.
- jsondecode converts JSON input into native maps, objects, lists or primitives used in expressions.
- lower converts letters to lowercase and is often used in consistent name expressions.
- merge overlays object or map arguments and chooses the value from the last argument containing a duplicate key.
- A for expression builds derived collection values, optionally filtering with an if clause and transforming keys or values.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to format each element of multiple lists using one common template, so it produces the behavior described. In contrast, the for expression serves a different goal: transform a collection's elements into a new list or map, not format each element of multiple lists using one common template.
Incorrect Answers
B:The description applies to the jsondecode function when an engineer needs to parse a JSON document string into Terraform values; the named the formatlist function instead handles the requirement to format each element of multiple lists using one common template, so this behavior does not describe The formatlist function in the situation named.
C:The description applies to the lower function when an engineer needs to normalize a string identifier to lowercase; the named the formatlist function instead handles the requirement to format each element of multiple lists using one common template, so this behavior does not describe The formatlist function in the situation named.
D:The description applies to the merge function when an engineer needs to combine maps with later values overriding earlier keys; the named the formatlist function instead handles the requirement to format each element of multiple lists using one common template, so this behavior does not describe The formatlist function in the situation named.
E:The description applies to the for expression when an engineer needs to transform a collection's elements into a new list or map; the named the formatlist function instead handles the requirement to format each element of multiple lists using one common template, so this behavior does not describe The formatlist function in the situation named.
Question 98
During a design review, the requirement is to guard a resource against prerequisites outside the provider's basic schema. Which option should the engineer select?
- The check block
- Custom conditions with unknown values
- Input validation versus check blocks
- Input variable validation
- Preconditions for external assumptions
Explanation
Correct Answer
E:A precondition can express a domain requirement such as a selected image having an expected property before using it; this directly meets the requirement to guard a resource against prerequisites outside the provider's basic schema. By comparison, custom conditions with unknown values is intended to understand when a validation cannot yet be decided at planning time, which is a different task from guard a resource against prerequisites outside the provider's basic schema.
Incorrect Answers
A:Check assertions evaluate health expectations and normally report warning diagnostics rather than blocking deployment on a false condition; this mechanism is useful when the job is to report a failed ongoing infrastructure assertion without ordinarily blocking the apply, whereas the current scenario requires the engineer to guard a resource against prerequisites outside the provider's basic schema. These operations have different effects in the stated Terraform workflow.
B:Terraform may defer condition evaluation to apply when required expression values are unknown during planning; this mechanism is useful when the job is to understand when a validation cannot yet be decided at planning time, whereas the current scenario requires the engineer to guard a resource against prerequisites outside the provider's basic schema. These operations have different effects in the stated Terraform workflow.
C:Variable validation rejects unacceptable values, whereas failed check assertions are intended for diagnostic warnings; this mechanism is useful when the job is to choose a blocking input constraint rather than a monitoring-style assertion, whereas the current scenario requires the engineer to guard a resource against prerequisites outside the provider's basic schema. These operations have different effects in the stated Terraform workflow.
D:The validation block uses a condition and a custom error_message to enforce rules on caller-supplied values; this mechanism is useful when the job is to reject malformed module inputs before provisioning resources, whereas the current scenario requires the engineer to guard a resource against prerequisites outside the provider's basic schema. These operations have different effects in the stated Terraform workflow.
Question 99
A Terraform deployment has independent requirements: (1) prevent incompatible provider upgrades from affecting resource handling; (2) avoid exposing full state when another stack only needs a published identifier. Which TWO mechanisms directly address these needs? Choose TWO.
- State resource addresses
- State locking
- Provider version compatibility
- The provider registry namespace
- Remote state sharing boundaries
Explanation
Correct Answers
C:Version constraints and a shared lock file reduce unintended schema and behavior changes between deployments; this meets the requirement to prevent incompatible provider upgrades from affecting resource handling, while the other selected techniques address avoid exposing full state when another stack only needs a published identifier, which require their own distinct Terraform mechanisms.
E:Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure; this meets the requirement to avoid exposing full state when another stack only needs a published identifier, while the other selected techniques address prevent incompatible provider upgrades from affecting resource handling, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons; it addresses identify which remote object corresponds to a particular configuration resource, but this delivery instead requires prevent incompatible provider upgrades from affecting resource handling and avoid exposing full state when another stack only needs a published identifier. The required combination involves Provider version compatibility and Remote state sharing boundaries, not the behavior of State resource addresses.
B:A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes; it addresses prevent concurrent state writers from overwriting each other's updates, but this delivery instead requires prevent incompatible provider upgrades from affecting resource handling and avoid exposing full state when another stack only needs a published identifier. The required combination involves Provider version compatibility and Remote state sharing boundaries, not the behavior of State locking.
D:The namespace portion of a source address separates provider publishers in the registry; it addresses identify the publisher when providers share a type name, but this delivery instead requires prevent incompatible provider upgrades from affecting resource handling and avoid exposing full state when another stack only needs a published identifier. The required combination involves Provider version compatibility and Remote state sharing boundaries, not the behavior of The provider registry namespace.
Question 100
A runbook lists “TF_LOG=DEBUG” for the task to enable diagnostic output with lower verbosity than TRACE. Which technical effect should its description include?
- Setting TF_LOG to DEBUG exposes useful troubleshooting messages without the full trace-level volume.
- Unsetting or disabling Terraform's TF_LOG environment setting removes extra diagnostic verbosity from later commands.
- INFO logging provides operational context with less detail than DEBUG and TRACE.
- Terraform diagnostic logs can include sensitive data, so access control and careful review are required before sharing them.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to enable diagnostic output with lower verbosity than TRACE, so it produces the behavior described. In contrast, disabling TF_LOG serves a different goal: return a shell session to ordinary Terraform logging after investigation, not enable diagnostic output with lower verbosity than TRACE.
Incorrect Answers
B:The description applies to disabling TF_LOG when an engineer needs to return a shell session to ordinary Terraform logging after investigation; the named TF_LOG=DEBUG instead handles the requirement to enable diagnostic output with lower verbosity than TRACE, so this behavior does not describe TF_LOG=DEBUG in the situation named.
C:The description applies to TF_LOG=INFO when an engineer needs to record higher-level operational messages during troubleshooting; the named TF_LOG=DEBUG instead handles the requirement to enable diagnostic output with lower verbosity than TRACE, so this behavior does not describe TF_LOG=DEBUG in the situation named.
D:The description applies to redacting shared diagnostic logs when an engineer needs to prevent troubleshooting output from leaking credentials or resource attributes; the named TF_LOG=DEBUG instead handles the requirement to enable diagnostic output with lower verbosity than TRACE, so this behavior does not describe TF_LOG=DEBUG in the situation named.