Question 560
A change request asks an engineer to connect reviewed repository commits to automated infrastructure plans. Which choice best implements the requested behavior?
- An API token for CLI connectivity
- HCP Terraform VCS integration
- A cloud workspaces tags setting
- terraform login
Explanation
Correct Answer
B:A VCS-connected workspace coordinates code changes, speculative plans and controlled applies through supported repository integration; this directly meets the requirement to connect reviewed repository commits to automated infrastructure plans. By comparison, terraform login is intended to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname, which is a different task from connect reviewed repository commits to automated infrastructure plans.
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 connect reviewed repository commits to automated infrastructure plans. These operations have different effects in the stated Terraform workflow.
C:The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form; this mechanism is useful when the job is to select an HCP Terraform workspace collection by workspace tags, whereas the current scenario requires the engineer to connect reviewed repository commits to automated infrastructure plans. These operations have different effects in the stated Terraform workflow.
D:The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate; this mechanism is useful when the job is to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname, whereas the current scenario requires the engineer to connect reviewed repository commits to automated infrastructure plans. These operations have different effects in the stated Terraform workflow.
Question 561
The team evaluates “The replace function” for a requirement to substitute matching substrings within a value. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- coalescelist evaluates list arguments and returns the first with at least one element.
- jsondecode converts JSON input into native maps, objects, lists or primitives used in expressions.
- keys returns a lexicographically sorted list of map keys, useful for deterministic iteration.
- replace searches a string for a matching substring or pattern and replaces matches with a new string.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to substitute matching substrings within a value, so it produces the behavior described. In contrast, the jsondecode function serves a different goal: parse a JSON document string into Terraform values, not substitute matching substrings within a value.
Incorrect Answers
A:The description applies to the coalescelist function when an engineer needs to choose the first nonempty list from several candidates; the named the replace function instead handles the requirement to substitute matching substrings within a value, so this behavior does not describe The replace function in the situation named.
B:The description applies to the jsondecode function when an engineer needs to parse a JSON document string into Terraform values; the named the replace function instead handles the requirement to substitute matching substrings within a value, so this behavior does not describe The replace function in the situation named.
C:The description applies to the keys function when an engineer needs to list the names of keys defined in a map; the named the replace function instead handles the requirement to substitute matching substrings within a value, so this behavior does not describe The replace function in the situation named.
Question 562
A team sharing an infrastructure state has a concrete implementation goal: detect and propose correction for changes made outside Terraform. What is the most appropriate Terraform mechanism?
- Import IDs defined by providers
- A normal plan with drift
- terraform state pull
- A moved block
Explanation
Correct Answer
B:Providers refresh remote resource attributes, and planning can propose updates to bring changed objects back to declared configuration; this directly meets the requirement to detect and propose correction for changes made outside Terraform. By comparison, import IDs defined by providers is intended to map an existing object's correct remote identifier to a Terraform address, which is a different task from detect and propose correction for changes made outside Terraform.
Incorrect Answers
A:Import commands require the provider-defined identity format, not an arbitrary local Terraform block label; this mechanism is useful when the job is to map an existing object's correct remote identifier to a Terraform address, whereas the current scenario requires the engineer to detect and propose correction for changes made outside Terraform. These operations have different effects in the stated Terraform workflow.
C:The state pull command retrieves state from the configured backend and prints a snapshot that may contain secrets; this mechanism is useful when the job is to obtain the current state snapshot for inspection or controlled backup, whereas the current scenario requires the engineer to detect and propose correction for changes made outside Terraform. These operations have different effects in the stated Terraform workflow.
D:A moved block maps an old Terraform address to a new one so state follows the refactor rather than planning destruction and creation; this mechanism is useful when the job is to rename or relocate a managed resource address without recreating the remote object, whereas the current scenario requires the engineer to detect and propose correction for changes made outside Terraform. These operations have different effects in the stated Terraform workflow.
Question 563
A Terraform state maintenance procedure needs to save the default workspace state to a nondefault local filename. Which feature or operation is the most direct match?
- Backend configuration only in a root module
- Local state in CI
- A local backend path setting
- The local backend's lack of team collaboration features
Explanation
Correct Answer
C:The local backend supports a path argument for where the state file is stored on disk; this directly meets the requirement to save the default workspace state to a nondefault local filename. By comparison, state file confidentiality is intended to protect a workstation's local state file even when output values are hidden, which is a different task from save the default workspace state to a nondefault local filename.
Incorrect Answers
A:Backend configuration is evaluated for the root module; defining backend settings inside reusable child modules does not give them separate state; this concerns the task to choose where a root deployment's state will be stored, not the current need to save the default workspace state to a nondefault local filename. A A local backend path setting approach is appropriate here; the substituted Backend configuration only in a root module option does not supply the specified Terraform capability.
B:A temporary runner may lose its filesystem after a job, so durable shared state is usually needed for repeatable team automation; this mechanism is useful when the job is to recognize why ephemeral build agents should not rely on a machine-local state file, whereas the current scenario requires the engineer to save the default workspace state to a nondefault local filename. These operations have different effects in the stated Terraform workflow.
D:The local backend's lack of team collaboration features is designed to avoid concurrent writes from multiple operators on different machines, rather than save the default workspace state to a nondefault local filename. Its normal effect is that local files do not provide an organization-wide shared state or distributed locking comparable to an appropriately configured remote backend.
Question 564
A change request asks an engineer to switch backend settings without performing automatic state migration. Which choice best implements the requested behavior?
- An HCP Terraform cloud block
- The S3 backend
- terraform init -reconfigure
- Backend state key separation
- Remote state encryption at rest
Explanation
Correct Answer
C:The reconfigure flag discards cached previous backend settings and does not copy the prior state snapshot; this directly meets the requirement to switch backend settings without performing automatic state migration. By comparison, an HCP Terraform cloud block is intended to integrate Terraform CLI with an HCP organization and workspace, which is a different task from switch backend settings without performing automatic state migration.
Incorrect Answers
A:The terraform cloud block connects configuration to HCP Terraform, and cannot coexist with a standard backend block in the same configuration; this mechanism is useful when the job is to integrate Terraform CLI with an HCP organization and workspace, whereas the current scenario requires the engineer to switch backend settings without performing automatic state migration. These operations have different effects in the stated Terraform workflow.
B:The S3 backend uses configured bucket and key settings, plus suitable authentication and optional locking support; this mechanism is useful when the job is to store Terraform state as an object in an S3 bucket, whereas the current scenario requires the engineer to switch backend settings without performing automatic state migration. These operations have different effects in the stated Terraform workflow.
D: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 switch backend settings without performing automatic state migration. These operations have different effects in the stated Terraform workflow.
E:Encryption is controlled by the chosen backend service; Terraform's remote backend abstraction does not supply one universal encryption mechanism; this mechanism is useful when the job is to protect stored state contents from unauthorized storage-layer access, whereas the current scenario requires the engineer to switch backend settings without performing automatic state migration. These operations have different effects in the stated Terraform workflow.
Question 565
During an infrastructure design review about how to supply the remote identifier in the format accepted by the resource's provider, a maintainer asks what “An import block's id argument” does. Which description is accurate?
- The import workflow adds an existing remote object to state and can manage it through later plans instead of creating a replacement automatically.
- The experimental config-generation flag can write suggested resource declarations for review and correction before apply.
- Provider documentation determines the required import identity; it may be an ID or compound identifier depending on resource type.
- Imported infrastructure should have a corresponding resource block with configuration matching the desired attributes so the next plan is safe.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to supply the remote identifier in the format accepted by the resource's provider, so it produces the behavior described. In contrast, a matching resource declaration serves a different goal: avoid unintended changes immediately after importing a remote object, not supply the remote identifier in the format accepted by the resource's provider.
Incorrect Answers
A:The description applies to importing without creating new infrastructure when an engineer needs to take ownership of an existing object rather than duplicating it; the named an import block's id argument instead handles the requirement to supply the remote identifier in the format accepted by the resource's provider, so this behavior does not describe An import block's id argument in the situation named.
B:The description applies to terraform plan -generate-config-out when an engineer needs to produce draft HCL for resources named in import blocks without matching configuration; the named an import block's id argument instead handles the requirement to supply the remote identifier in the format accepted by the resource's provider, so this behavior does not describe An import block's id argument in the situation named.
D:The description applies to a matching resource declaration when an engineer needs to avoid unintended changes immediately after importing a remote object; the named an import block's id argument instead handles the requirement to supply the remote identifier in the format accepted by the resource's provider, so this behavior does not describe An import block's id argument in the situation named.
Question 566
A Terraform change proposal names “A write-only argument version field” to force an update when a write-only secret changes without exposing the secret itself. Which outcome can reviewers attribute to that particular mechanism?
- Some write-only provider arguments expose an accompanying nonsecret version marker that triggers a new operation when incremented.
- Vault's dynamic credentials can provide expiring access with centrally enforced policies instead of permanent embedded keys.
- Protecting state requires backend encryption, identity-based authorization and controlled access because state can store raw secret values.
- Base64 is reversible encoding; exposing encoded credentials in configuration or state still risks disclosure.
- A sensitive output is redacted in regular presentation, while JSON or raw output modes may reveal its value.
- Provider-supported ephemeral resources exist only during an operation and can feed appropriate ephemeral consumers.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to force an update when a write-only secret changes without exposing the secret itself, so it produces the behavior described. In contrast, sensitive = true on an output serves a different goal: prevent a private output from appearing in normal human-readable CLI output, not force an update when a write-only secret changes without exposing the secret itself.
Incorrect Answers
B:The description applies to vault short-lived credentials when an engineer needs to limit the lifetime and scope of identities used by infrastructure automation; the named a write-only argument version field instead handles the requirement to force an update when a write-only secret changes without exposing the secret itself, so this behavior does not describe A write-only argument version field in the situation named.
C:The description applies to remote state access controls when an engineer needs to prevent unauthorized operators from reading sensitive resource attributes; the named a write-only argument version field instead handles the requirement to force an update when a write-only secret changes without exposing the secret itself, so this behavior does not describe A write-only argument version field in the situation named.
D:The description applies to not treating Base64 as secrecy when an engineer needs to recognize that an encoded password remains sensitive information; the named a write-only argument version field instead handles the requirement to force an update when a write-only secret changes without exposing the secret itself, so this behavior does not describe A write-only argument version field in the situation named.
E:The description applies to sensitive = true on an output when an engineer needs to prevent a private output from appearing in normal human-readable CLI output; the named a write-only argument version field instead handles the requirement to force an update when a write-only secret changes without exposing the secret itself, so this behavior does not describe A write-only argument version field in the situation named.
F:The description applies to an ephemeral resource block when an engineer needs to retrieve or generate temporary data that should not be persisted in Terraform state; the named a write-only argument version field instead handles the requirement to force an update when a write-only secret changes without exposing the secret itself, so this behavior does not describe A write-only argument version field in the situation named.
Question 567
During a design review, the requirement is to recreate the same logical infrastructure design across test and production. Which option should the engineer select?
- Repeatable environment definition
- Desired-state reconciliation
- HCL configuration files
- Provider-mediated API operations
Explanation
Correct Answer
A:IaC configuration provides repeatable definitions; variables and isolated state allow environments to differ without independently hand-building each object; this directly meets the requirement to recreate the same logical infrastructure design across test and production. By comparison, desired-state reconciliation is intended to identify changes between the declared configuration and managed infrastructure, which is a different task from recreate the same logical infrastructure design across test and production.
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 recreate the same logical infrastructure design across test and production. These operations have different effects in the stated Terraform workflow.
C: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 recreate the same logical infrastructure design across test and production. These operations have different effects in the stated Terraform workflow.
D:Terraform Core evaluates configuration while provider plugins implement the provider-specific API operations; this mechanism is useful when the job is to manage infrastructure services through a shared declarative workflow, whereas the current scenario requires the engineer to recreate the same logical infrastructure design across test and production. These operations have different effects in the stated Terraform workflow.
Question 568
A platform team separating infrastructure deployments requires a way to grant operators different abilities to view, plan or apply workspace changes. Which Terraform approach most directly fulfills that request?
- Project-based permission boundaries
- Organization variable sets
- Workspace run approvals
- HCP team permissions
Explanation
Correct Answer
D:Team access controls define which users may perform supported workspace operations rather than relying only on provider credentials; this directly meets the requirement to grant operators different abilities to view, plan or apply workspace changes. By comparison, organization variable sets is intended to supply shared environment or Terraform input values across several workspaces, which is a different task from grant operators different abilities to view, plan or apply workspace changes.
Incorrect Answers
A:Projects group workspaces and support scoped access management for organizational teams; this mechanism is useful when the job is to delegate administration of grouped HCP Terraform workspaces, whereas the current scenario requires the engineer to grant operators different abilities to view, plan or apply workspace changes. These operations have different effects in the stated Terraform workflow.
B:Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects; this mechanism is useful when the job is to supply shared environment or Terraform input values across several workspaces, whereas the current scenario requires the engineer to grant operators different abilities to view, plan or apply workspace changes. These operations have different effects in the stated Terraform workflow.
C:HCP Terraform approval workflow separates viewing a plan from the permission to proceed with an apply; this mechanism is useful when the job is to require an authorized person to approve a run before applying changes, whereas the current scenario requires the engineer to grant operators different abilities to view, plan or apply workspace changes. These operations have different effects in the stated Terraform workflow.
Question 569
An engineer intends to expose a chosen internal attribute to the calling parent module and is reviewing “A child module output”. What consequence follows from using it as intended?
- Root variables accept runtime assignments, whereas a child module normally receives its inputs through the parent's module call.
- A default inside the child variable declaration applies when the caller omits that module argument.
- An object type lets a module enforce named configuration fields instead of accepting many untyped values.
- The output block defines a published module interface; the parent reads the value as module.NAME.OUTPUT.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to expose a chosen internal attribute to the calling parent module, so it produces the behavior described. In contrast, input object variables serves a different goal: pass a structured settings bundle into a reusable module, not expose a chosen internal attribute to the calling parent module.
Incorrect Answers
A:The description applies to root input variable scope when an engineer needs to read command-line and tfvars input values for the root module; the named a child module output instead handles the requirement to expose a chosen internal attribute to the calling parent module, so this behavior does not describe A child module output in the situation named.
B:The description applies to a variable default inside a child when an engineer needs to make a module input optional when callers do not require customization; the named a child module output instead handles the requirement to expose a chosen internal attribute to the calling parent module, so this behavior does not describe A child module output in the situation named.
C:The description applies to input object variables when an engineer needs to pass a structured settings bundle into a reusable module; the named a child module output instead handles the requirement to expose a chosen internal attribute to the calling parent module, so this behavior does not describe A child module output in the situation named.
Question 570
A new infrastructure-as-code adoption project has a concrete implementation goal: coordinate an on-premises platform with public-cloud resources. What is the most appropriate Terraform mechanism?
- Hybrid infrastructure provisioning
- Provider-specific capabilities
- Integrating platform and DNS configuration
- Isolating deployment boundaries
Explanation
Correct Answer
A:Providers can represent both on-premises platforms and cloud services as Terraform-managed resources in one workflow; this directly meets the requirement to coordinate an on-premises platform with public-cloud resources. By comparison, isolating deployment boundaries is intended to limit the impact of changes to one environment or platform, which is a different task from coordinate an on-premises platform with public-cloud resources.
Incorrect Answers
B:A shared Terraform language does not erase provider API differences; each provider defines supported resource schemas and behavior; this mechanism is useful when the job is to avoid assuming that all providers expose identical resource types and options, whereas the current scenario requires the engineer to coordinate an on-premises platform with public-cloud resources. These operations have different effects in the stated Terraform workflow.
C:Distinct providers can manage compute and DNS resources while references communicate values such as an assigned endpoint; this mechanism is useful when the job is to manage a cloud-hosted service and its DNS records declaratively, whereas the current scenario requires the engineer to coordinate an on-premises platform with public-cloud resources. These operations have different effects in the stated Terraform workflow.
D:Separate root modules and state files reduce shared-plan scope when different teams or lifecycles require isolation; this mechanism is useful when the job is to limit the impact of changes to one environment or platform, whereas the current scenario requires the engineer to coordinate an on-premises platform with public-cloud resources. These operations have different effects in the stated Terraform workflow.