Question 910
During a design review, the requirement is to identify which root-module-managed resources will be affected before a cleanup. Which option should the engineer select?
- terraform apply -destroy
- Dependency-aware deletion
- An explicit prevent_destroy rule
- Destroy plan risk review
Explanation
Correct Answer
D:Reviewing a destroy plan is essential because a command can remove every managed instance within the relevant state scope; this directly meets the requirement to identify which root-module-managed resources will be affected before a cleanup. By comparison, terraform apply -destroy is intended to execute a destroy-mode apply within a controlled workflow, which is a different task from identify which root-module-managed resources will be affected before a cleanup.
Incorrect Answers
A:The destroy mode tells apply to plan removal of managed resources rather than ordinary convergence to resource declarations; this mechanism is useful when the job is to execute a destroy-mode apply within a controlled workflow, whereas the current scenario requires the engineer to identify which root-module-managed resources will be affected before a cleanup. These operations have different effects in the stated Terraform workflow.
B:Terraform generally reverses dependency order when destroying managed resources so dependent objects are removed first; this mechanism is useful when the job is to remove dependent resources before objects they rely on, whereas the current scenario requires the engineer to identify which root-module-managed resources will be affected before a cleanup. These operations have different effects in the stated Terraform workflow.
C:The lifecycle prevent_destroy setting rejects a plan that destroys or replaces a configured resource while the rule remains present; this mechanism is useful when the job is to block a destructive plan for a protected configured resource, whereas the current scenario requires the engineer to identify which root-module-managed resources will be affected before a cleanup. These operations have different effects in the stated Terraform workflow.
Question 911
An operations team replacing ad-hoc scripts has a concrete implementation goal: review a proposed infrastructure change before team members deploy it. What is the most appropriate Terraform mechanism?
- Version-controlled infrastructure definition
- Desired-state reconciliation
- A resource graph
- HCL configuration files
Explanation
Correct Answer
A:Infrastructure configuration can be committed and reviewed in version control so the intended change is traceable before a Terraform run; this directly meets the requirement to review a proposed infrastructure change before team members deploy it. By comparison, HCL configuration files is intended to represent managed infrastructure using Terraform's native declarative language, which is a different task from review a proposed infrastructure change before team members deploy it.
Incorrect Answers
B:Planning compares configuration with state and refreshed remote data to propose actions that reconcile differences; this mechanism is useful when the job is to identify changes between the declared configuration and managed infrastructure, whereas the current scenario requires the engineer to review a proposed infrastructure change before team members deploy it. These operations have different effects in the stated Terraform workflow.
C:Terraform derives dependency edges from references, using the graph to order dependent changes and permit safe parallel operations; this mechanism is useful when the job is to determine a safe sequence for creating objects with references between them, whereas the current scenario requires the engineer to review a proposed infrastructure change before team members deploy it. These operations have different effects in the stated Terraform workflow.
D:Terraform reads .tf files written in HCL, including blocks, arguments, expressions and references that describe the intended objects; this mechanism is useful when the job is to represent managed infrastructure using Terraform's native declarative language, whereas the current scenario requires the engineer to review a proposed infrastructure change before team members deploy it. These operations have different effects in the stated Terraform workflow.
Question 912
A new Terraform working directory requires a way to determine which arguments a resource type accepts. Which Terraform approach most directly fulfills that request?
- A provider plugin
- Provider authentication environment variables
- Provider integrity hashes
- Provider-defined resource schemas
Explanation
Correct Answer
D:The provider declares accepted resource arguments and computed attributes; Terraform validates configuration against that schema; this directly meets the requirement to determine which arguments a resource type accepts. By comparison, provider integrity hashes is intended to detect a mismatched plugin distribution package, which is a different task from determine which arguments a resource type accepts.
Incorrect Answers
A:Providers implement resource and data-source schemas plus read, create, update and delete operations for their services; this mechanism is useful when the job is to translate Terraform resource operations into calls to the relevant remote API, whereas the current scenario requires the engineer to determine which arguments a resource type accepts. These operations have different effects in the stated Terraform workflow.
B:Many provider plugins can read credentials from provider-specific environment variables or identity mechanisms, reducing secret exposure in configuration; this mechanism is useful when the job is to avoid hard-coding a provider's API credential into .tf files, whereas the current scenario requires the engineer to determine which arguments a resource type accepts. These operations have different effects in the stated Terraform workflow.
C:Terraform checks downloaded provider package checksums against lock information where hashes are available; this mechanism is useful when the job is to detect a mismatched plugin distribution package, whereas the current scenario requires the engineer to determine which arguments a resource type accepts. These operations have different effects in the stated Terraform workflow.
Question 913
A configuration review for an application stack has a concrete implementation goal: extract a single element from a collection that contains zero or one elements. What is the most appropriate Terraform mechanism?
- The ternary conditional operator
- The one function
- The base64encode function
- The cidrhost function
Explanation
Correct Answer
B:one returns the lone member, or null if empty, and reports an error when more than one element exists; this directly meets the requirement to extract a single element from a collection that contains zero or one elements. By comparison, the ternary conditional operator is intended to set a resource argument according to a boolean expression, which is a different task from extract a single element from a collection that contains zero or one elements.
Incorrect Answers
A: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 extract a single element from a collection that contains zero or one elements. These operations have different effects in the stated Terraform workflow.
C:base64encode applies a reversible encoding and should not be mistaken for encryption of secrets; this mechanism is useful when the job is to turn ordinary string content into Base64 text, whereas the current scenario requires the engineer to extract a single element from a collection that contains zero or one elements. These operations have different effects in the stated Terraform workflow.
D:cidrhost computes a host address inside the given prefix from a numeric host index; this mechanism is useful when the job is to calculate an IP address at an offset within a CIDR range, whereas the current scenario requires the engineer to extract a single element from a collection that contains zero or one elements. These operations have different effects in the stated Terraform workflow.
Question 914
The team evaluates “Apply using current credentials” for a requirement to determine which identity actually performs infrastructure changes. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- Provider API operations use the provider's configured credentials or supported ambient authentication, not the login name in a commit.
- The -input=false option prevents prompts for missing input, requiring all necessary values and approvals to be handled by automation.
- A partial apply may have changed some resources, so Terraform should refresh and build a new plan rather than blindly assuming a full rollback.
- The -var option supplies a named input for the execution; it does not edit the variable declaration in code.
- The -var-file option loads values from an input variables file, enabling separate environment assignments.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to determine which identity actually performs infrastructure changes, so it produces the behavior described. In contrast, noninteractive apply settings serves a different goal: run Terraform in automation where prompting is not acceptable, not determine which identity actually performs infrastructure changes.
Incorrect Answers
B:The description applies to noninteractive apply settings when an engineer needs to run Terraform in automation where prompting is not acceptable; the named apply using current credentials instead handles the requirement to determine which identity actually performs infrastructure changes, so this behavior does not describe Apply using current credentials in the situation named.
C:The description applies to apply failure recovery when an engineer needs to inspect state and re-plan when a provider operation fails partway through; the named apply using current credentials instead handles the requirement to determine which identity actually performs infrastructure changes, so this behavior does not describe Apply using current credentials in the situation named.
D:The description applies to apply with -var when an engineer needs to override a declared root-module input value for a particular run; the named apply using current credentials instead handles the requirement to determine which identity actually performs infrastructure changes, so this behavior does not describe Apply using current credentials in the situation named.
E:The description applies to apply with a .tfvars file when an engineer needs to supply a named collection of input assignments to Terraform; the named apply using current credentials instead handles the requirement to determine which identity actually performs infrastructure changes, so this behavior does not describe Apply using current credentials in the situation named.
Question 915
An engineer troubleshooting a .tf configuration needs to retrieve root outputs for integration with another program. Which feature or operation is the most direct match?
- A variable default value
- A required input variable
- Passing module inputs explicitly
- terraform output -json
Explanation
Correct Answer
D:The JSON output mode serializes output values and metadata for automation; it can expose sensitive values and must be protected; this directly meets the requirement to retrieve root outputs for integration with another program. By comparison, passing module inputs explicitly is intended to configure a child module with parent-provided values, which is a different task from retrieve root outputs for integration with another program.
Incorrect Answers
A:The default argument supplies a value when the caller provides no other assignment for that variable; this mechanism is useful when the job is to make a module input optional for callers using a common baseline, whereas the current scenario requires the engineer to retrieve root outputs for integration with another program. These operations have different effects in the stated Terraform workflow.
B:A variable block without a default requires a provided value if Terraform cannot otherwise obtain one; this mechanism is useful when the job is to ask the caller for a value when no default should be assumed, whereas the current scenario requires the engineer to retrieve root outputs for integration with another program. These operations have different effects in the stated Terraform workflow.
C:The module block assigns arguments corresponding to input variables declared in the child; variables are scoped to modules; this mechanism is useful when the job is to configure a child module with parent-provided values, whereas the current scenario requires the engineer to retrieve root outputs for integration with another program. These operations have different effects in the stated Terraform workflow.
Question 916
A reusable module interface review has a concrete implementation goal: pin a VCS module to a specific Git branch, tag or commit. What is the most appropriate Terraform mechanism?
- A Git ref query parameter
- A private registry module source
- The double-slash source subdirectory
- An absolute local module source
Explanation
Correct Answer
A:A source address ending in ?ref=... selects a Git revision; it does not use the registry-specific module version argument; this directly meets the requirement to pin a VCS module to a specific Git branch, tag or commit. By comparison, a private registry module source is intended to reuse an internally published module available to authorized organization members, which is a different task from pin a VCS module to a specific Git branch, tag or commit.
Incorrect Answers
B:HCP Terraform's private registry can distribute approved modules with access control and supported version metadata; this mechanism is useful when the job is to reuse an internally published module available to authorized organization members, whereas the current scenario requires the engineer to pin a VCS module to a specific Git branch, tag or commit. These operations have different effects in the stated Terraform workflow.
C:Module source syntax places //subdir after the package address to select the intended directory within the downloaded package; this mechanism is useful when the job is to use a nested module stored below a repository's root directory, whereas the current scenario requires the engineer to pin a VCS module to a specific Git branch, tag or commit. These operations have different effects in the stated Terraform workflow.
D:Terraform can load a module from a local filesystem path, though absolute paths make configurations less portable; this mechanism is useful when the job is to call a child module from an explicit filesystem path, whereas the current scenario requires the engineer to pin a VCS module to a specific Git branch, tag or commit. These operations have different effects in the stated Terraform workflow.
Question 917
During a design review, the requirement is to select an HCP Terraform workspace collection by workspace tags. Which option should the engineer select?
- An API token for CLI connectivity
- Terraform Enterprise hostname selection
- Migrating state to HCP Terraform
- A cloud workspaces tags setting
- Dynamic provider credential integration
Explanation
Correct Answer
D:The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form; this directly meets the requirement to select an HCP Terraform workspace collection by workspace tags. By comparison, Terraform Enterprise hostname selection is intended to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, which is a different task from select an HCP Terraform workspace collection by workspace tags.
Incorrect Answers
A:The HCP service token controls platform API authentication and is distinct from provider credentials used to modify cloud infrastructure; this mechanism is useful when the job is to authorize a Terraform CLI workflow to access an HCP Terraform organization, whereas the current scenario requires the engineer to select an HCP Terraform workspace collection by workspace tags. These operations have different effects in the stated Terraform workflow.
B:The cloud hostname setting and login host identify the relevant service installation for organization operations; this mechanism is useful when the job is to connect the CLI to a privately deployed Terraform Enterprise service rather than app.terraform.io, whereas the current scenario requires the engineer to select an HCP Terraform workspace collection by workspace tags. These operations have different effects in the stated Terraform workflow.
C:Migration requires setting HCP Terraform integration and handling state transfer rather than starting a blank workspace against existing objects; this mechanism is useful when the job is to move an established root configuration from local state into a managed HCP workspace, whereas the current scenario requires the engineer to select an HCP Terraform workspace collection by workspace tags. These operations have different effects in the stated Terraform workflow.
E:Dynamic credentials integrate HCP Terraform with supported identity federation to obtain scoped run credentials; this mechanism is useful when the job is to grant HCP runs temporary cloud authorization instead of long-lived static secrets, whereas the current scenario requires the engineer to select an HCP Terraform workspace collection by workspace tags. These operations have different effects in the stated Terraform workflow.
Question 918
A team compares Terraform mechanisms for the goal to obtain detailed Terraform core and provider diagnostic output while troubleshooting. Which stated consequence belongs specifically to “TF_LOG=TRACE”?
- The TF_LOG_CORE variable can control log verbosity for Core messages independently of general logging.
- TF_LOG_PATH directs log output to a file and should be combined with an enabled TF_LOG level.
- Setting TF_LOG to DEBUG exposes useful troubleshooting messages without the full trace-level volume.
- Terraform logging set to TRACE emits highly verbose diagnostic detail and may contain sensitive information.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to obtain detailed Terraform core and provider diagnostic output while troubleshooting, so it produces the behavior described. In contrast, TF_LOG_PATH serves a different goal: save enabled Terraform diagnostic logs to a designated file, not obtain detailed Terraform core and provider diagnostic output while troubleshooting.
Incorrect Answers
A:The description applies to TF_LOG_CORE when an engineer needs to focus verbose diagnostics on Terraform Core rather than all plugin activity; the named TF_LOG=TRACE instead handles the requirement to obtain detailed Terraform core and provider diagnostic output while troubleshooting, so this behavior does not describe TF_LOG=TRACE in the situation named.
B:The description applies to TF_LOG_PATH when an engineer needs to save enabled Terraform diagnostic logs to a designated file; the named TF_LOG=TRACE instead handles the requirement to obtain detailed Terraform core and provider diagnostic output while troubleshooting, so this behavior does not describe TF_LOG=TRACE in the situation named.
C:The description applies to TF_LOG=DEBUG when an engineer needs to enable diagnostic output with lower verbosity than TRACE; the named TF_LOG=TRACE instead handles the requirement to obtain detailed Terraform core and provider diagnostic output while troubleshooting, so this behavior does not describe TF_LOG=TRACE in the situation named.
Question 919
During a design review, the requirement is to adopt a new remote state destination after editing configuration. Which option should the engineer select?
- Init after changing state storage
- Backend credentials from the environment
- Backend state key separation
- Partial backend configuration
Explanation
Correct Answer
A:Terraform detects changed backend settings and requires initialization with an explicit migration or reconfiguration choice; this directly meets the requirement to adopt a new remote state destination after editing configuration. By comparison, backend credentials from the environment is intended to avoid embedding cloud backend access keys into tracked Terraform source, which is a different task from adopt a new remote state destination after editing configuration.
Incorrect Answers
B:Supported backends can discover authentication from environment settings or identity mechanisms rather than inline key literals; this mechanism is useful when the job is to avoid embedding cloud backend access keys into tracked Terraform source, whereas the current scenario requires the engineer to adopt a new remote state destination after editing configuration. These operations have different effects in the stated Terraform workflow.
C:Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot; this mechanism is useful when the job is to store different applications' state snapshots at distinct object paths, whereas the current scenario requires the engineer to adopt a new remote state destination after editing configuration. These operations have different effects in the stated Terraform workflow.
D:Backend config arguments supplied at init time fill required values, but sensitive content can still be cached in local metadata or plans; this mechanism is useful when the job is to provide environment-specific backend details at initialization rather than hard-coding them, whereas the current scenario requires the engineer to adopt a new remote state destination after editing configuration. These operations have different effects in the stated Terraform workflow.
Question 920
During a design review, the requirement is to refer specifically to the second object of a count-created resource. Which option should the engineer select?
- A data attribute reference
- An instance address with count
- each.value
- A module output reference
- An implicit attribute dependency
Explanation
Correct Answer
B:Count instances have numeric indexes such as aws_instance.web[1] for the second instance; this directly meets the requirement to refer specifically to the second object of a count-created resource. By comparison, each.value is intended to read the per-instance map value when iterating with for_each, which is a different task from refer specifically to the second object of a count-created resource.
Incorrect Answers
A:The syntax data.TYPE.NAME.ATTRIBUTE accesses attributes returned by an existing-object query; this mechanism is useful when the job is to read a field from a configured data source in another expression, whereas the current scenario requires the engineer to refer specifically to the second object of a count-created resource. These operations have different effects in the stated Terraform workflow.
C:For a map-based for_each collection, each.value exposes the value associated with the current each.key; this mechanism is useful when the job is to read the per-instance map value when iterating with for_each, whereas the current scenario requires the engineer to refer specifically to the second object of a count-created resource. These operations have different effects in the stated Terraform workflow.
D:Parent configurations access child outputs using module.CHILD.OUTPUT; private child resource addresses are not automatically exported; this mechanism is useful when the job is to use a child module's published value in a parent resource, whereas the current scenario requires the engineer to refer specifically to the second object of a count-created resource. These operations have different effects in the stated Terraform workflow.
E: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 refer specifically to the second object of a count-created resource. These operations have different effects in the stated Terraform workflow.