Question 10
A Terraform reviewer encounters “Environment-based provider credentials” while assessing how to avoid putting provider access tokens directly in configuration source. Which statement correctly describes its actual behavior?
- Providers can often authenticate through environment variables or identity integrations so credentials are absent from checked-in HCL.
- Provider-supported ephemeral resources exist only during an operation and can feed appropriate ephemeral consumers.
- A sensitive output is redacted in regular presentation, while JSON or raw output modes may reveal its value.
- Sensitive marks a value for redaction in UI output, but regular sensitive values can still be persisted in plan and state files.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to avoid putting provider access tokens directly in configuration source, so it produces the behavior described. In contrast, an ephemeral resource block serves a different goal: retrieve or generate temporary data that should not be persisted in Terraform state, not avoid putting provider access tokens directly in configuration source.
Incorrect Answers
B: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 environment-based provider credentials instead handles the requirement to avoid putting provider access tokens directly in configuration source, so this behavior does not describe Environment-based provider credentials in the situation named.
C: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 environment-based provider credentials instead handles the requirement to avoid putting provider access tokens directly in configuration source, so this behavior does not describe Environment-based provider credentials in the situation named.
D:The description applies to sensitive = true on a variable when an engineer needs to hide a supplied secret from ordinary CLI display without removing it from state; the named environment-based provider credentials instead handles the requirement to avoid putting provider access tokens directly in configuration source, so this behavior does not describe Environment-based provider credentials in the situation named.
Question 11
The team evaluates “Remote backend support for workspaces” for a requirement to use multiple logical state namespaces when the backend implementation supports it. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- The terraform cloud block connects configuration to HCP Terraform, and cannot coexist with a standard backend block in the same configuration.
- Terraform detects changed backend settings and requires initialization with an explicit migration or reconfiguration choice.
- Workspace support depends on the selected backend, and each workspace tracks its own state snapshot.
- Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to use multiple logical state namespaces when the backend implementation supports it, so it produces the behavior described. In contrast, backend state key separation serves a different goal: store different applications' state snapshots at distinct object paths, not use multiple logical state namespaces when the backend implementation supports it.
Incorrect Answers
A:The description applies to an HCP Terraform cloud block when an engineer needs to integrate Terraform CLI with an HCP organization and workspace; the named remote backend support for workspaces instead handles the requirement to use multiple logical state namespaces when the backend implementation supports it, so this behavior does not describe Remote backend support for workspaces in the situation named.
B:The description applies to init after changing state storage when an engineer needs to adopt a new remote state destination after editing configuration; the named remote backend support for workspaces instead handles the requirement to use multiple logical state namespaces when the backend implementation supports it, so this behavior does not describe Remote backend support for workspaces in the situation named.
D:The description applies to backend state key separation when an engineer needs to store different applications' state snapshots at distinct object paths; the named remote backend support for workspaces instead handles the requirement to use multiple logical state namespaces when the backend implementation supports it, so this behavior does not describe Remote backend support for workspaces in the situation named.
Question 12
An engineer proposes “Explicit provider selection on data blocks” to use two unrelated service APIs in one root configuration. Which outcome does the proposed technique actually provide?
- List both plugins under required_providers and configure each service's provider independently as needed.
- A data block can set provider = aws.secondary to query through an alternate provider configuration.
- The module call's providers argument maps the child's expected provider configuration name to a provider configuration available in the parent.
- The resource-level provider meta-argument selects a provider instance, not a different backend or Terraform workspace.
Explanation
Correct Answer
B:Explicit provider selection on data blocks is used when an operator needs to read an object from a secondary account rather than the default account. Consequently, this choice cannot meet the separate requirement to use two unrelated service APIs in one root configuration. The intended action would instead require Separate required provider names.
Incorrect Answers
A:That outcome belongs to Separate required provider names, the mechanism that can use two unrelated service APIs in one root configuration. The question concerns the engineer’s actual proposal, Explicit provider selection on data blocks; it is directed at read an object from a secondary account rather than the default account, not that result.
C:This behavior belongs to The providers map on a module call, which helps engineers pass an aliased provider configuration into a child module rather than satisfying the separate requirement to use two unrelated service APIs in one root configuration. The attempted technique was Explicit provider selection on data blocks; it would instead be used to read an object from a secondary account rather than the default account, not to produce the effect associated with The providers map on a module call.
D:This behavior belongs to A resource's provider meta-argument, which helps engineers route a particular managed object to the named alternate provider configuration rather than satisfying the separate requirement to use two unrelated service APIs in one root configuration. The attempted technique was Explicit provider selection on data blocks; it would instead be used to read an object from a secondary account rather than the default account, not to produce the effect associated with A resource's provider meta-argument.
Question 13
A Terraform change proposal names “Implicit provider selection” to use the default provider configuration for a resource type. Which outcome can reviewers attribute to that particular mechanism?
- Terraform checks downloaded provider package checksums against lock information where hashes are available.
- 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.
- Providers retrieve object details so Terraform can compare observed infrastructure against desired configuration and prior state.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to use the default provider configuration for a resource type, 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 use the default provider configuration for a resource type.
Incorrect Answers
A:The description applies to provider integrity hashes when an engineer needs to detect a mismatched plugin distribution package; the named implicit provider selection instead handles the requirement to use the default provider configuration for a resource type, so this behavior does not describe Implicit provider selection 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 implicit provider selection instead handles the requirement to use the default provider configuration for a resource type, so this behavior does not describe Implicit provider selection in the situation named.
D:The description applies to provider data refresh when an engineer needs to read current attributes of managed remote objects during planning; the named implicit provider selection instead handles the requirement to use the default provider configuration for a resource type, so this behavior does not describe Implicit provider selection in the situation named.
Question 14
A Terraform state maintenance procedure has a concrete implementation goal: avoid embedding cloud backend access keys into tracked Terraform source. What is the most appropriate Terraform mechanism?
- Remote state encryption at rest
- Backend credentials from the environment
- Remote backend access permissions
- Init after changing state storage
Explanation
Correct Answer
B:Supported backends can discover authentication from environment settings or identity mechanisms rather than inline key literals; this directly meets the requirement to avoid embedding cloud backend access keys into tracked Terraform source. By comparison, remote state encryption at rest is intended to protect stored state contents from unauthorized storage-layer access, which is a different task from avoid embedding cloud backend access keys into tracked Terraform source.
Incorrect Answers
A: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 avoid embedding cloud backend access keys into tracked Terraform source. These operations have different effects in the stated Terraform workflow.
C:Cloud storage policy and backend authorization decide who can obtain or mutate stored Terraform state; provider credentials alone are not sufficient; this mechanism is useful when the job is to enforce read and write privileges on the state object, whereas the current scenario requires the engineer to avoid embedding cloud backend access keys into tracked Terraform source. These operations have different effects in the stated Terraform workflow.
D:Terraform detects changed backend settings and requires initialization with an explicit migration or reconfiguration choice; this mechanism is useful when the job is to adopt a new remote state destination after editing configuration, whereas the current scenario requires the engineer to avoid embedding cloud backend access keys into tracked Terraform source. These operations have different effects in the stated Terraform workflow.
Question 15
An engineer intends to audit the results of infrastructure changes across a team and is reviewing “Reusable execution records”. What consequence follows from using it as intended?
- A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design.
- Terraform input variables permit different values for capacity, names and endpoints without copying the entire resource definition.
- With no configuration or remote drift requiring action, a new plan normally proposes no infrastructure changes.
- Version control and run history provide traceable context for what configuration changed and what Terraform planned or applied.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to audit the results of infrastructure changes across a team, so it produces the behavior described. In contrast, reusing modules serves a different goal: standardize a reusable network pattern across multiple applications, not audit the results of infrastructure changes across a team.
Incorrect Answers
A:The description applies to reusing modules when an engineer needs to standardize a reusable network pattern across multiple applications; the named reusable execution records instead handles the requirement to audit the results of infrastructure changes across a team, so this behavior does not describe Reusable execution records in the situation named.
B:The description applies to environment parametrization when an engineer needs to deploy similarly structured stacks with environment-specific settings; the named reusable execution records instead handles the requirement to audit the results of infrastructure changes across a team, so this behavior does not describe Reusable execution records in the situation named.
C:The description applies to idempotent convergence when an engineer needs to run unchanged configuration repeatedly without inventing new infrastructure updates; the named reusable execution records instead handles the requirement to audit the results of infrastructure changes across a team, so this behavior does not describe Reusable execution records in the situation named.
Question 16
A Terraform change proposal names “Canonical HCL alignment” to keep spacing and indentation consistent between developers. Which outcome can reviewers attribute to that particular mechanism?
- The fmt operation normalizes the presentation of configuration source, not the meaning of provider API calls.
- Check mode verifies formatting and returns a failure when changes would be required instead of writing edited files.
- The fmt command rewrites HCL source according to Terraform's formatting conventions without provisioning resources.
- The recursive switch extends formatting into subdirectories rather than limiting the operation to the current directory.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to keep spacing and indentation consistent between developers, 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 keep spacing and indentation consistent between developers.
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 canonical HCL alignment instead handles the requirement to keep spacing and indentation consistent between developers, so this behavior does not describe Canonical HCL alignment in the situation named.
C:The description applies to terraform fmt when an engineer needs to apply Terraform's canonical formatting to local .tf source files; the named canonical HCL alignment instead handles the requirement to keep spacing and indentation consistent between developers, so this behavior does not describe Canonical HCL alignment in the situation named.
D:The description applies to terraform fmt -recursive when an engineer needs to format Terraform files in nested directories under a module tree; the named canonical HCL alignment instead handles the requirement to keep spacing and indentation consistent between developers, so this behavior does not describe Canonical HCL alignment in the situation named.
Question 17
During a design review, the requirement is to serialize operations that write the same Terraform state. Which option should the engineer select?
- HCP Terraform run serialization
- Lock ownership verification
- A backend state lock
- Not disabling locking for speed
Explanation
Correct Answer
C:Supported backends acquire a state lock so simultaneous writers cannot corrupt or overwrite each other's state changes; this directly meets the requirement to serialize operations that write the same Terraform state. By comparison, HCP Terraform run serialization is intended to avoid multiple infrastructure applies targeting the same shared HCP workspace state, which is a different task from serialize operations that write the same Terraform state.
Incorrect Answers
A:HCP Terraform coordinates workspace runs and state handling, reducing conflicts among collaborating operators; this mechanism is useful when the job is to avoid multiple infrastructure applies targeting the same shared HCP workspace state, whereas the current scenario requires the engineer to serialize operations that write the same Terraform state. These operations have different effects in the stated Terraform workflow.
B:A lock may belong to another active run, so check its identity and run status rather than immediately forcing removal; this mechanism is useful when the job is to confirm that a held lock is stale before attempting manual removal, whereas the current scenario requires the engineer to serialize operations that write the same Terraform state. These operations have different effects in the stated Terraform workflow.
D:The -lock=false option bypasses locking safeguards and increases the risk of two runs writing inconsistent state; this mechanism is useful when the job is to avoid conflicting state updates during concurrent deployments, whereas the current scenario requires the engineer to serialize operations that write the same Terraform state. These operations have different effects in the stated Terraform workflow.
Question 18
A Terraform operations troubleshooting session requires a way to view attributes for a specified state-tracked resource instance. Which Terraform approach most directly fulfills that request?
- terraform state rm
- terraform workspace select
- terraform state pull
- terraform state show ADDRESS
Explanation
Correct Answer
D:State show presents one resource's stored attributes in human-readable form and may reveal secret values; this directly meets the requirement to view attributes for a specified state-tracked resource instance. By comparison, terraform state pull is intended to export a state snapshot from the configured backend for careful examination, which is a different task from view attributes for a specified state-tracked resource instance.
Incorrect Answers
A:State rm deletes the state association, not the object in the external system; this mechanism is useful when the job is to stop tracking a resource without telling its provider to delete the remote object, whereas the current scenario requires the engineer to view attributes for a specified state-tracked resource instance. These operations have different effects in the stated Terraform workflow.
B:Workspace selection changes which workspace state namespace the root configuration uses; it does not select a cloud account automatically; this mechanism is useful when the job is to switch the currently selected Terraform CLI workspace, whereas the current scenario requires the engineer to view attributes for a specified state-tracked resource instance. These operations have different effects in the stated Terraform workflow.
C:State pull reads the current snapshot to standard output, including potentially sensitive provider attributes; this mechanism is useful when the job is to export a state snapshot from the configured backend for careful examination, whereas the current scenario requires the engineer to view attributes for a specified state-tracked resource instance. These operations have different effects in the stated Terraform workflow.
Question 19
During a design review, the requirement is to list the names of keys defined in a map. Which option should the engineer select?
- The concat function
- The sha256 function
- The keys function
- The jsondecode function
Explanation
Correct Answer
C:keys returns a lexicographically sorted list of map keys, useful for deterministic iteration; this directly meets the requirement to list the names of keys defined in a map. By comparison, the jsondecode function is intended to parse a JSON document string into Terraform values, which is a different task from list the names of keys defined in a map.
Incorrect Answers
A:concat joins lists end to end and preserves their element ordering, including duplicate values; this mechanism is useful when the job is to append the elements of multiple lists into one sequence, whereas the current scenario requires the engineer to list the names of keys defined in a map. These operations have different effects in the stated Terraform workflow.
B:sha256 computes a one-way hash of a string, not an encrypted recoverable secret or random credential; this mechanism is useful when the job is to create a deterministic SHA-256 digest for content comparison, whereas the current scenario requires the engineer to list the names of keys defined in a map. These operations have different effects in the stated Terraform workflow.
D:jsondecode converts JSON input into native maps, objects, lists or primitives used in expressions; this mechanism is useful when the job is to parse a JSON document string into Terraform values, whereas the current scenario requires the engineer to list the names of keys defined in a map. These operations have different effects in the stated Terraform workflow.
Question 20
Reviewers reject “State locking” as a way to detect actual resource attributes rather than relying only on historical saved values. Which actual behavior explains why the proposal is unsuitable?
- A normal plan attempts to refresh state from providers before comparing objects to the current configuration.
- A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes.
- State can retain dependency information needed to correctly destroy objects no longer declared in configuration.
- State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons.
Explanation
Correct Answer
B:State locking is used when an operator needs to prevent concurrent state writers from overwriting each other's updates. Consequently, this choice cannot meet the separate requirement to detect actual resource attributes rather than relying only on historical saved values. The intended action would instead require Terraform refresh during planning.
Incorrect Answers
A:That outcome belongs to Terraform refresh during planning, the mechanism that can detect actual resource attributes rather than relying only on historical saved values. The question concerns the engineer’s actual proposal, State locking; it is directed at prevent concurrent state writers from overwriting each other's updates, not that result.
C:This behavior belongs to State-backed dependency links, which helps engineers maintain dependencies for resources that have been removed from configuration rather than satisfying the separate requirement to detect actual resource attributes rather than relying only on historical saved values. The attempted technique was State locking; it would instead be used to prevent concurrent state writers from overwriting each other's updates, not to produce the effect associated with State-backed dependency links.
D:This behavior belongs to State resource addresses, which helps engineers identify which remote object corresponds to a particular configuration resource rather than satisfying the separate requirement to detect actual resource attributes rather than relying only on historical saved values. The attempted technique was State locking; it would instead be used to prevent concurrent state writers from overwriting each other's updates, not to produce the effect associated with State resource addresses.