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.
Question 921
A release pipeline preparing provider access needs to understand how successive snapshots are ordered. Which feature or operation is the most direct match?
- Remote state sharing boundaries
- State locking
- State resource addresses
- The state serial number
Explanation
Correct Answer
D:State metadata includes lineage and serial information that helps Terraform identify state history and updates; this directly meets the requirement to understand how successive snapshots are ordered. By comparison, state locking is intended to prevent concurrent state writers from overwriting each other's updates, which is a different task from understand how successive snapshots are ordered.
Incorrect Answers
A:Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure; this mechanism is useful when the job is to avoid exposing full state when another stack only needs a published identifier, whereas the current scenario requires the engineer to understand how successive snapshots are ordered. These operations have different effects in the stated Terraform workflow.
B:A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes; this mechanism is useful when the job is to prevent concurrent state writers from overwriting each other's updates, whereas the current scenario requires the engineer to understand how successive snapshots are ordered. These operations have different effects in the stated Terraform workflow.
C:State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons; this mechanism is useful when the job is to identify which remote object corresponds to a particular configuration resource, whereas the current scenario requires the engineer to understand how successive snapshots are ordered. These operations have different effects in the stated Terraform workflow.
Question 922
During an infrastructure design review about how to compute and reuse a derived expression without asking callers to supply it, a maintainer asks what “A locals block” does. Which description is accurate?
- Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state.
- A variable block without a default requires a provided value if Terraform cannot otherwise obtain one.
- Local values are internal named expressions accessed using local.NAME; they are not module input parameters.
- The module block assigns arguments corresponding to input variables declared in the child; variables are scoped to modules.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to compute and reuse a derived expression without asking callers to supply it, so it produces the behavior described. In contrast, passing module inputs explicitly serves a different goal: configure a child module with parent-provided values, not compute and reuse a derived expression without asking callers to supply it.
Incorrect Answers
A:The description applies to a sensitive output when an engineer needs to hide a secret-like output from Terraform's usual human-readable display; the named a locals block instead handles the requirement to compute and reuse a derived expression without asking callers to supply it, so this behavior does not describe A locals block in the situation named.
B:The description applies to a required input variable when an engineer needs to ask the caller for a value when no default should be assumed; the named a locals block instead handles the requirement to compute and reuse a derived expression without asking callers to supply it, so this behavior does not describe A locals block in the situation named.
D:The description applies to passing module inputs explicitly when an engineer needs to configure a child module with parent-provided values; the named a locals block instead handles the requirement to compute and reuse a derived expression without asking callers to supply it, so this behavior does not describe A locals block in the situation named.
Question 923
During an infrastructure design review about how to resolve missing provider schemas before checking configuration, a maintainer asks what “Validate after init” does. Which description is accurate?
- Because validate consults provider and module definitions, run init first to install referenced dependencies.
- The Terraform test command executes defined test runs and assertions, which can exercise behavior beyond basic configuration validation.
- The validate command checks syntax and schema consistency in an initialized configuration without obtaining a full execution plan.
- The fmt -check option exits with a failure status when source files would need formatting changes rather than altering them.
- Validation compares configuration with provider schemas and reports missing required fields.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to resolve missing provider schemas before checking configuration, so it produces the behavior described. In contrast, terraform validate serves a different goal: check that Terraform configuration is structurally valid without planning resource changes, not resolve missing provider schemas before checking configuration.
Incorrect Answers
B:The description applies to terraform test when an engineer needs to run declarative module tests instead of only checking syntax; the named validate after init instead handles the requirement to resolve missing provider schemas before checking configuration, so this behavior does not describe Validate after init in the situation named.
C:The description applies to terraform validate when an engineer needs to check that Terraform configuration is structurally valid without planning resource changes; the named validate after init instead handles the requirement to resolve missing provider schemas before checking configuration, so this behavior does not describe Validate after init in the situation named.
D:The description applies to terraform fmt -check when an engineer needs to verify formatting without rewriting the files in a CI job; the named validate after init instead handles the requirement to resolve missing provider schemas before checking configuration, so this behavior does not describe Validate after init in the situation named.
E:The description applies to missing required argument detection when an engineer needs to catch a resource block lacking a mandatory argument; the named validate after init instead handles the requirement to resolve missing provider schemas before checking configuration, so this behavior does not describe Validate after init in the situation named.
Question 924
A reusable infrastructure definition requires a way to bring a previously unmanaged remote object under a resource block's lifecycle. Which Terraform approach most directly fulfills that request?
- Importing an existing object
- A data-source reference
- A resource attribute reference
- Provider resource type prefixes
Explanation
Correct Answer
A:Import associates a configured resource address with an existing remote object's provider identity in Terraform state; this directly meets the requirement to bring a previously unmanaged remote object under a resource block's lifecycle. By comparison, provider resource type prefixes is intended to identify which provider implements a resource's API operations, which is a different task from bring a previously unmanaged remote object under a resource block's lifecycle.
Incorrect Answers
B:References to data.TYPE.NAME.attribute retrieve values supplied by a read-only provider data source; this mechanism is useful when the job is to use attributes read from an existing resource when configuring a new managed object, whereas the current scenario requires the engineer to bring a previously unmanaged remote object under a resource block's lifecycle. These operations have different effects in the stated Terraform workflow.
C:References like aws_vpc.main.id use a managed resource's attributes and create an implicit dependency; this mechanism is useful when the job is to pass a newly managed object's computed identifier to a dependent resource, whereas the current scenario requires the engineer to bring a previously unmanaged remote object under a resource block's lifecycle. These operations have different effects in the stated Terraform workflow.
D:A resource type name usually starts with its provider local name, such as aws_instance for the AWS provider; this mechanism is useful when the job is to identify which provider implements a resource's API operations, whereas the current scenario requires the engineer to bring a previously unmanaged remote object under a resource block's lifecycle. These operations have different effects in the stated Terraform workflow.
Question 925
During one infrastructure delivery, the team must satisfy all of the following: (1) identify remote infrastructure deviations through scheduled or managed health assessments; (2) move a workspace to a different organizational group without merging infrastructure state; (3) avoid declaring both HCP cloud integration and a standard backend in the same root module. Select THREE appropriate Terraform approaches. Choose THREE.
- Distinct production and staging workspaces
- Drift detection in HCP Terraform
- Project membership changes
- Organization variable sets
- Mutual exclusivity of cloud and backend
- An HCP private registry module source
Explanation
Correct Answers
B:HCP Terraform health features can detect changes made outside the workspace's managed Terraform workflow; this meets the requirement to identify remote infrastructure deviations through scheduled or managed health assessments, while the other selected techniques address move a workspace to a different organizational group without merging infrastructure state and avoid declaring both HCP cloud integration and a standard backend in the same root module, which require their own distinct Terraform mechanisms.
C:A project is a grouping and access construct; changing project assignment does not turn two workspaces into one state; this meets the requirement to move a workspace to a different organizational group without merging infrastructure state, while the other selected techniques address identify remote infrastructure deviations through scheduled or managed health assessments and avoid declaring both HCP cloud integration and a standard backend in the same root module, which require their own distinct Terraform mechanisms.
E:Terraform does not allow simultaneous cloud and backend blocks because both would compete to control the state and execution connection; this meets the requirement to avoid declaring both HCP cloud integration and a standard backend in the same root module, while the other selected techniques address identify remote infrastructure deviations through scheduled or managed health assessments and move a workspace to a different organizational group without merging infrastructure state, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:Each HCP Terraform workspace has its own state and run configuration so changes in one do not automatically update the other; it addresses isolate state and runs for two deployment environments, but this delivery instead requires identify remote infrastructure deviations through scheduled or managed health assessments and move a workspace to a different organizational group without merging infrastructure state and avoid declaring both HCP cloud integration and a standard backend in the same root module. The required combination involves Drift detection in HCP Terraform and Project membership changes and Mutual exclusivity of cloud and backend, not the behavior of Distinct production and staging workspaces.
D:Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects; it addresses supply shared environment or Terraform input values across several workspaces, but this delivery instead requires identify remote infrastructure deviations through scheduled or managed health assessments and move a workspace to a different organizational group without merging infrastructure state and avoid declaring both HCP cloud integration and a standard backend in the same root module. The required combination involves Drift detection in HCP Terraform and Project membership changes and Mutual exclusivity of cloud and backend, not the behavior of Organization variable sets.
F:A module source can reference a private registry hostname and namespace after the client has appropriate authentication; it addresses consume a module managed by the organization's HCP private registry, but this delivery instead requires identify remote infrastructure deviations through scheduled or managed health assessments and move a workspace to a different organizational group without merging infrastructure state and avoid declaring both HCP cloud integration and a standard backend in the same root module. The required combination involves Drift detection in HCP Terraform and Project membership changes and Mutual exclusivity of cloud and backend, not the behavior of An HCP private registry module source.
Question 926
A team compares Terraform mechanisms for the goal to select a specific VCS module release without using a registry version argument. Which stated consequence belongs specifically to “A Git tag pin for a module”?
- A Git module's ?ref= tag or commit selects a repository revision instead of a registry module version constraint.
- Provider versions are constrained in required_providers and locked in .terraform.lock.hcl; registry modules use their module block version arguments.
- A module version ~> 2.1.0 permits 2.1.x releases but excludes 2.2.0 and later.
- Changing a module source or version constraint requires reinitializing to resolve the updated selection.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to select a specific VCS module release without using a registry version argument, so it produces the behavior described. In contrast, a pessimistic module version constraint serves a different goal: allow compatible patch updates within a module's minor release series, not select a specific VCS module release without using a registry version argument.
Incorrect Answers
B:The description applies to provider and module version separation when an engineer needs to avoid confusing provider plugin selection with reusable module source selection; the named a Git tag pin for a module instead handles the requirement to select a specific VCS module release without using a registry version argument, so this behavior does not describe A Git tag pin for a module in the situation named.
C:The description applies to a pessimistic module version constraint when an engineer needs to allow compatible patch updates within a module's minor release series; the named a Git tag pin for a module instead handles the requirement to select a specific VCS module release without using a registry version argument, so this behavior does not describe A Git tag pin for a module in the situation named.
D:The description applies to init after module version change when an engineer needs to install a newly allowed child module release after editing its version requirement; the named a Git tag pin for a module instead handles the requirement to select a specific VCS module release without using a registry version argument, so this behavior does not describe A Git tag pin for a module in the situation named.
Question 927
A runbook lists “Formatting versus validation” for the task to distinguish style-only issues from Terraform type and schema errors. Which technical effect should its description include?
- terraform fmt addresses canonical HCL layout while terraform validate checks whether the configuration is structurally acceptable.
- Check mode verifies formatting and returns a failure when changes would be required instead of writing edited files.
- The fmt operation normalizes the presentation of configuration source, not the meaning of provider API calls.
- The fmt command rewrites HCL source according to Terraform's formatting conventions without provisioning resources.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to distinguish style-only issues from Terraform type and schema errors, so it produces the behavior described. In contrast, terraform fmt serves a different goal: apply Terraform's canonical formatting to local .tf source files, not distinguish style-only issues from Terraform type and schema errors.
Incorrect Answers
B:The description applies to terraform fmt -check when an engineer needs to make a CI formatting gate detect source files that need formatting; the named formatting versus validation instead handles the requirement to distinguish style-only issues from Terraform type and schema errors, so this behavior does not describe Formatting versus validation in the situation named.
C:The description applies to canonical HCL alignment when an engineer needs to keep spacing and indentation consistent between developers; the named formatting versus validation instead handles the requirement to distinguish style-only issues from Terraform type and schema errors, so this behavior does not describe Formatting versus validation in the situation named.
D:The description applies to terraform fmt when an engineer needs to apply Terraform's canonical formatting to local .tf source files; the named formatting versus validation instead handles the requirement to distinguish style-only issues from Terraform type and schema errors, so this behavior does not describe Formatting versus validation in the situation named.
Question 928
During an infrastructure design review about how to enumerate managed resource instance addresses in the current state, a maintainer asks what “terraform state list” does. Which description is accurate?
- The providers command displays provider requirements and their module relationships for dependency troubleshooting.
- State rm deletes the state association, not the object in the external system.
- Replace-provider rewrites provider source references in state and creates a backup before the edit.
- The state list subcommand prints stored addresses without changing infrastructure or state content.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to enumerate managed resource instance addresses in the current state, so it produces the behavior described. In contrast, terraform providers serves a different goal: inspect which providers the current configuration requires, not enumerate managed resource instance addresses in the current state.
Incorrect Answers
A:The description applies to terraform providers when an engineer needs to inspect which providers the current configuration requires; the named terraform state list instead handles the requirement to enumerate managed resource instance addresses in the current state, so this behavior does not describe terraform state list in the situation named.
B:The description applies to terraform state rm when an engineer needs to stop tracking a resource without telling its provider to delete the remote object; the named terraform state list instead handles the requirement to enumerate managed resource instance addresses in the current state, so this behavior does not describe terraform state list in the situation named.
C:The description applies to terraform state replace-provider when an engineer needs to update the provider source address recorded for affected state resources; the named terraform state list instead handles the requirement to enumerate managed resource instance addresses in the current state, so this behavior does not describe terraform state list in the situation named.
Question 929
A runbook lists “Resource removal without deletion” for the task to retain a remote object but stop Terraform from managing it. Which technical effect should its description include?
- A provider data source can resolve the zone ID for use in managed records while the zone itself remains outside that configuration's resource lifecycle.
- A resource block has a type and a local label; together they form its address within the module.
- A removed block with destroy = false can express a configuration-driven removal from state while leaving the infrastructure object intact.
- When a managed resource is absent from configuration but still tracked in state, normal planning proposes its destruction.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to retain a remote object but stop Terraform from managing it, so it produces the behavior described. In contrast, data sources as external lookups serves a different goal: use an existing DNS zone from a provider without taking ownership of the zone, not retain a remote object but stop Terraform from managing it.
Incorrect Answers
A:The description applies to data sources as external lookups when an engineer needs to use an existing DNS zone from a provider without taking ownership of the zone; the named resource removal without deletion instead handles the requirement to retain a remote object but stop Terraform from managing it, so this behavior does not describe Resource removal without deletion in the situation named.
B:The description applies to resource local names when an engineer needs to distinguish two managed instances of the same provider-defined resource type; the named resource removal without deletion instead handles the requirement to retain a remote object but stop Terraform from managing it, so this behavior does not describe Resource removal without deletion in the situation named.
D:The description applies to removing a resource declaration when an engineer needs to plan to delete a previously managed object that remains in state; the named resource removal without deletion instead handles the requirement to retain a remote object but stop Terraform from managing it, so this behavior does not describe Resource removal without deletion in the situation named.
Question 930
A team compares Terraform mechanisms for the goal to avoid hard-coding a provider's API credential into .tf files. Which stated consequence belongs specifically to “Provider authentication environment variables”?
- Providers retrieve object details so Terraform can compare observed infrastructure against desired configuration and prior state.
- Terraform generally selects the default provider matching a resource's type prefix unless an alternate configuration is specified.
- A provider's data source reads existing data and exposes attributes without creating or destroying the queried object.
- Many provider plugins can read credentials from provider-specific environment variables or identity mechanisms, reducing secret exposure in configuration.
- Version constraints and a shared lock file reduce unintended schema and behavior changes between deployments.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to avoid hard-coding a provider's API credential into .tf files, so it produces the behavior described. In contrast, provider-defined data sources serves a different goal: read information from an external service without owning its lifecycle, not avoid hard-coding a provider's API credential into .tf files.
Incorrect Answers
A:The description applies to provider data refresh when an engineer needs to read current attributes of managed remote objects during planning; the named provider authentication environment variables instead handles the requirement to avoid hard-coding a provider's API credential into .tf files, so this behavior does not describe Provider authentication environment variables in the situation named.
B:The description applies to implicit provider selection when an engineer needs to use the default provider configuration for a resource type; the named provider authentication environment variables instead handles the requirement to avoid hard-coding a provider's API credential into .tf files, so this behavior does not describe Provider authentication environment variables in the situation named.
C:The description applies to provider-defined data sources when an engineer needs to read information from an external service without owning its lifecycle; the named provider authentication environment variables instead handles the requirement to avoid hard-coding a provider's API credential into .tf files, so this behavior does not describe Provider authentication environment variables in the situation named.
E:The description applies to provider version compatibility when an engineer needs to prevent incompatible provider upgrades from affecting resource handling; the named provider authentication environment variables instead handles the requirement to avoid hard-coding a provider's API credential into .tf files, so this behavior does not describe Provider authentication environment variables in the situation named.