Question 810
During one infrastructure delivery, the team must satisfy all of the following: (1) wait for prerequisite objects before considering resources in another module; (2) coerce a suitable collection into a list for ordered operations. Select TWO appropriate Terraform approaches. Choose TWO.
- An object type
- ignore_changes on a tag
- tolist conversion
- depends_on for module calls
- Lifecycle ordering versus API support
- Dependency cycle resolution
Explanation
Correct Answers
C:tolist converts compatible values to a list, but a source set's original order is not inherently meaningful; this meets the requirement to coerce a suitable collection into a list for ordered operations, while the other selected techniques address wait for prerequisite objects before considering resources in another module, which require their own distinct Terraform mechanisms.
D:A module block can declare depends_on so all managed objects inside it observe the specified dependency relationship; this meets the requirement to wait for prerequisite objects before considering resources in another module, while the other selected techniques address coerce a suitable collection into a list for ordered operations, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:object({ name = string, size = number }) specifies per-attribute types for a structured input; it addresses require a named structure with typed attributes, but this delivery instead requires wait for prerequisite objects before considering resources in another module and coerce a suitable collection into a list for ordered operations. The required combination involves tolist conversion and depends_on for module calls, not the behavior of An object type.
B:The lifecycle ignore_changes list excludes chosen attributes from later update comparisons while creation still considers configured values; it addresses allow another system to update selected attributes without Terraform reverting them, but this delivery instead requires wait for prerequisite objects before considering resources in another module and coerce a suitable collection into a list for ordered operations. The required combination involves tolist conversion and depends_on for module calls, not the behavior of ignore_changes on a tag.
E:Terraform can request early replacement creation, but remote API constraints may disallow two objects with the same globally unique name; it addresses understand why create_before_destroy can still fail on a uniquely named object, but this delivery instead requires wait for prerequisite objects before considering resources in another module and coerce a suitable collection into a list for ordered operations. The required combination involves tolist conversion and depends_on for module calls, not the behavior of Lifecycle ordering versus API support.
F:Dependency cycles cannot be topologically ordered and require restructuring the relationships or splitting responsibilities; it addresses correct a pair of modules that each require the other's output to initialize, but this delivery instead requires wait for prerequisite objects before considering resources in another module and coerce a suitable collection into a list for ordered operations. The required combination involves tolist conversion and depends_on for module calls, not the behavior of Dependency cycle resolution.
Question 811
A Terraform change proposal names “The coalescelist function” to choose the first nonempty list from several candidates. Which outcome can reviewers attribute to that particular mechanism?
- coalescelist evaluates list arguments and returns the first with at least one element.
- cidrhost computes a host address inside the given prefix from a numeric host index.
- dynamic constructs blocks required by resource schemas; it does not create standalone Terraform resource declarations.
- The condition ? value_a : value_b expression chooses a suitable branch without creating duplicate resource blocks.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to choose the first nonempty list from several candidates, so it produces the behavior described. In contrast, the dynamic block serves a different goal: generate repeated nested blocks from a collection, not choose the first nonempty list from several candidates.
Incorrect Answers
B:The description applies to the cidrhost function when an engineer needs to calculate an IP address at an offset within a CIDR range; the named the coalescelist function instead handles the requirement to choose the first nonempty list from several candidates, so this behavior does not describe The coalescelist function in the situation named.
C:The description applies to the dynamic block when an engineer needs to generate repeated nested blocks from a collection; the named the coalescelist function instead handles the requirement to choose the first nonempty list from several candidates, so this behavior does not describe The coalescelist function in the situation named.
D:The description applies to the ternary conditional operator when an engineer needs to set a resource argument according to a boolean expression; the named the coalescelist function instead handles the requirement to choose the first nonempty list from several candidates, so this behavior does not describe The coalescelist function in the situation named.
Question 812
An engineer intends to reject a design that tries to publish a runtime-only value through the root output table and is reviewing “No ephemeral root output”. What consequence follows from using it as intended?
- Terraform does not permit ephemeral = true on root-module output blocks, because their ordinary purpose is persistent presentation.
- Vault's dynamic credentials can provide expiring access with centrally enforced policies instead of permanent embedded keys.
- Secrets inserted directly into tracked configuration can leak through repository history, regardless of later state redaction.
- Saved plan files may contain sensitive values and must be handled as confidential artifacts rather than safe public summaries.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to reject a design that tries to publish a runtime-only value through the root output table, so it produces the behavior described. In contrast, vault short-lived credentials serves a different goal: limit the lifetime and scope of identities used by infrastructure automation, not reject a design that tries to publish a runtime-only value through the root output table.
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 no ephemeral root output instead handles the requirement to reject a design that tries to publish a runtime-only value through the root output table, so this behavior does not describe No ephemeral root output in the situation named.
C:The description applies to no secrets in version control when an engineer needs to keep API keys out of committed terraform.tfvars and .tf files; the named no ephemeral root output instead handles the requirement to reject a design that tries to publish a runtime-only value through the root output table, so this behavior does not describe No ephemeral root output in the situation named.
D:The description applies to preventing credential leaks in plans when an engineer needs to avoid sharing a plan artifact publicly just because console values appear redacted; the named no ephemeral root output instead handles the requirement to reject a design that tries to publish a runtime-only value through the root output table, so this behavior does not describe No ephemeral root output in the situation named.
Question 813
An engineer intends to detect actual resource attributes rather than relying only on historical saved values and is reviewing “Terraform refresh during planning”. What consequence follows from using it as intended?
- Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure.
- The state snapshot records managed instance data and metadata needed to plan future actions.
- A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes.
- A normal plan attempts to refresh state from providers before comparing objects to the current configuration.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to detect actual resource attributes rather than relying only on historical saved values, so it produces the behavior described. In contrast, remote state sharing boundaries serves a different goal: avoid exposing full state when another stack only needs a published identifier, not detect actual resource attributes rather than relying only on historical saved values.
Incorrect Answers
A:The description applies to remote state sharing boundaries when an engineer needs to avoid exposing full state when another stack only needs a published identifier; the named Terraform refresh during planning instead handles the requirement to detect actual resource attributes rather than relying only on historical saved values, so this behavior does not describe Terraform refresh during planning in the situation named.
B:The description applies to state snapshots when an engineer needs to preserve Terraform's knowledge of managed infrastructure between CLI runs; the named Terraform refresh during planning instead handles the requirement to detect actual resource attributes rather than relying only on historical saved values, so this behavior does not describe Terraform refresh during planning in the situation named.
C:The description applies to state locking when an engineer needs to prevent concurrent state writers from overwriting each other's updates; the named Terraform refresh during planning instead handles the requirement to detect actual resource attributes rather than relying only on historical saved values, so this behavior does not describe Terraform refresh during planning in the situation named.
Question 814
A maintenance engineer inspecting a deployment requires a way to save enabled Terraform diagnostic logs to a designated file. Which Terraform approach most directly fulfills that request?
- Disabling TF_LOG
- Redacting shared diagnostic logs
- TF_LOG=INFO
- TF_LOG_PATH
Explanation
Correct Answer
D:TF_LOG_PATH directs log output to a file and should be combined with an enabled TF_LOG level; this directly meets the requirement to save enabled Terraform diagnostic logs to a designated file. By comparison, redacting shared diagnostic logs is intended to prevent troubleshooting output from leaking credentials or resource attributes, which is a different task from save enabled Terraform diagnostic logs to a designated file.
Incorrect Answers
A:Unsetting or disabling Terraform's TF_LOG environment setting removes extra diagnostic verbosity from later commands; this mechanism is useful when the job is to return a shell session to ordinary Terraform logging after investigation, whereas the current scenario requires the engineer to save enabled Terraform diagnostic logs to a designated file. These operations have different effects in the stated Terraform workflow.
B:Terraform diagnostic logs can include sensitive data, so access control and careful review are required before sharing them; this mechanism is useful when the job is to prevent troubleshooting output from leaking credentials or resource attributes, whereas the current scenario requires the engineer to save enabled Terraform diagnostic logs to a designated file. These operations have different effects in the stated Terraform workflow.
C:INFO logging provides operational context with less detail than DEBUG and TRACE; this mechanism is useful when the job is to record higher-level operational messages during troubleshooting, whereas the current scenario requires the engineer to save enabled Terraform diagnostic logs to a designated file. These operations have different effects in the stated Terraform workflow.
Question 815
An engineer intends to copy a known working state's snapshot into a new configured backend and is reviewing “terraform init -migrate-state”. What consequence follows from using it as intended?
- The S3 backend uses configured bucket and key settings, plus suitable authentication and optional locking support.
- After changing backend configuration, migrate-state attempts to transfer existing state instead of starting with an empty one.
- Workspace support depends on the selected backend, and each workspace tracks its own state snapshot.
- The terraform cloud block connects configuration to HCP Terraform, and cannot coexist with a standard backend block in the same configuration.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to copy a known working state's snapshot into a new configured backend, so it produces the behavior described. In contrast, the S3 backend serves a different goal: store Terraform state as an object in an S3 bucket, not copy a known working state's snapshot into a new configured backend.
Incorrect Answers
A:The description applies to the S3 backend when an engineer needs to store Terraform state as an object in an S3 bucket; the named terraform init -migrate-state instead handles the requirement to copy a known working state's snapshot into a new configured backend, so this behavior does not describe terraform init -migrate-state in the situation named.
C:The description applies to remote backend support for workspaces when an engineer needs to use multiple logical state namespaces when the backend implementation supports it; the named terraform init -migrate-state instead handles the requirement to copy a known working state's snapshot into a new configured backend, so this behavior does not describe terraform init -migrate-state in the situation named.
D: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 terraform init -migrate-state instead handles the requirement to copy a known working state's snapshot into a new configured backend, so this behavior does not describe terraform init -migrate-state in the situation named.
Question 816
A runbook lists “terraform state mv” for the task to change the address of a tracked object directly within state. Which technical effect should its description include?
- Configuration still describes the preferred value, so normal planning can propose undoing an out-of-band modification unless ignored.
- A plan does not discover every unmanaged object in an account; its normal focus is tracked resources and configured data sources.
- A data block can read an external object's attributes while avoiding taking over its create-update-delete lifecycle.
- The state mv command reassigns a managed resource's address without contacting the provider to destroy the object.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to change the address of a tracked object directly within state, so it produces the behavior described. In contrast, a data source instead of import serves a different goal: refer to shared infrastructure that another stack owns without changing its lifecycle, not change the address of a tracked object directly within state.
Incorrect Answers
A:The description applies to a refreshed changed resource when an engineer needs to understand why Terraform tries to reset a manually edited resource attribute; the named terraform state mv instead handles the requirement to change the address of a tracked object directly within state, so this behavior does not describe terraform state mv in the situation named.
B:The description applies to drift detection boundaries when an engineer needs to understand that Terraform only examines infrastructure represented in its configuration or state scope; the named terraform state mv instead handles the requirement to change the address of a tracked object directly within state, so this behavior does not describe terraform state mv in the situation named.
C:The description applies to a data source instead of import when an engineer needs to refer to shared infrastructure that another stack owns without changing its lifecycle; the named terraform state mv instead handles the requirement to change the address of a tracked object directly within state, so this behavior does not describe terraform state mv in the situation named.
Question 817
An engineer intends to avoid using provider versions from a newer unsupported major release and is reviewing “An upper-bound provider constraint”. What consequence follows from using it as intended?
- The providers lock subcommand updates dependency lock information, including hashes for specified target operating-system platforms.
- A required_providers entry maps a local provider name to its source address and version constraint; it does not configure API credentials.
- Terraform uses provider source metadata and its configured installation methods to find and install the appropriate plugin binary.
- The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections.
- A constraint such as < 6.0.0 prevents selection of versions that reach the excluded release boundary.
Explanation
Correct Answer
E:The named mechanism is used when the objective is to avoid using provider versions from a newer unsupported major release, so it produces the behavior described. In contrast, the required_providers block serves a different goal: declare where a provider plugin comes from and which versions are acceptable, not avoid using provider versions from a newer unsupported major release.
Incorrect Answers
A:The description applies to terraform providers lock when an engineer needs to populate provider package checksums for selected platforms; the named an upper-bound provider constraint instead handles the requirement to avoid using provider versions from a newer unsupported major release, so this behavior does not describe An upper-bound provider constraint in the situation named.
B:The description applies to the required_providers block when an engineer needs to declare where a provider plugin comes from and which versions are acceptable; the named an upper-bound provider constraint instead handles the requirement to avoid using provider versions from a newer unsupported major release, so this behavior does not describe An upper-bound provider constraint in the situation named.
C:The description applies to provider registry installation when an engineer needs to retrieve a published plugin from its declared registry source; the named an upper-bound provider constraint instead handles the requirement to avoid using provider versions from a newer unsupported major release, so this behavior does not describe An upper-bound provider constraint in the situation named.
D:The description applies to terraform init -upgrade when an engineer needs to intentionally reconsider previously locked provider and module selections; the named an upper-bound provider constraint instead handles the requirement to avoid using provider versions from a newer unsupported major release, so this behavior does not describe An upper-bound provider constraint in the situation named.
Question 818
A Terraform module author has a concrete implementation goal: load a nonstandard variable file selected for one environment. What is the most appropriate Terraform mechanism?
- A required input variable
- The variable type argument
- A root output block
- The -var-file option
Explanation
Correct Answer
D:The -var-file flag explicitly selects a variables file rather than relying on auto-loaded naming conventions; this directly meets the requirement to load a nonstandard variable file selected for one environment. By comparison, a required input variable is intended to ask the caller for a value when no default should be assumed, which is a different task from load a nonstandard variable file selected for one environment.
Incorrect Answers
A: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 load a nonstandard variable file selected for one environment. These operations have different effects in the stated Terraform workflow.
B:A variable's type constraint enforces the intended structure and allows appropriate Terraform type conversions; this mechanism is useful when the job is to reject caller values that cannot satisfy the declared input type, whereas the current scenario requires the engineer to load a nonstandard variable file selected for one environment. These operations have different effects in the stated Terraform workflow.
C:An output block exposes an expression value to CLI users and supported automation or cross-configuration consumers; this mechanism is useful when the job is to publish a computed result after applying a root module, whereas the current scenario requires the engineer to load a nonstandard variable file selected for one environment. These operations have different effects in the stated Terraform workflow.
Question 819
A configuration review for an application stack requires a way to model a Terraform-managed lifecycle value without requiring an external service object. Which Terraform approach most directly fulfills that request?
- Removing a resource declaration
- Resource local names
- A resource attribute reference
- The terraform_data resource
Explanation
Correct Answer
D:The built-in terraform_data resource can represent input changes and trigger replacement behavior without managing a cloud API resource; this directly meets the requirement to model a Terraform-managed lifecycle value without requiring an external service object. By comparison, a resource attribute reference is intended to pass a newly managed object's computed identifier to a dependent resource, which is a different task from model a Terraform-managed lifecycle value without requiring an external service object.
Incorrect Answers
A:When a managed resource is absent from configuration but still tracked in state, normal planning proposes its destruction; this mechanism is useful when the job is to plan to delete a previously managed object that remains in state, whereas the current scenario requires the engineer to model a Terraform-managed lifecycle value without requiring an external service object. These operations have different effects in the stated Terraform workflow.
B:A resource block has a type and a local label; together they form its address within the module; this mechanism is useful when the job is to distinguish two managed instances of the same provider-defined resource type, whereas the current scenario requires the engineer to model a Terraform-managed lifecycle value without requiring an external service object. 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 model a Terraform-managed lifecycle value without requiring an external service object. These operations have different effects in the stated Terraform workflow.
Question 820
A change request asks an engineer to display configuration and state dependencies for troubleshooting. Which choice best implements the requested behavior?
- terraform graph
- terraform plan -refresh=false
- terraform plan -refresh-only
- terraform show on a plan file
- A resource action marked minus
Explanation
Correct Answer
A:The graph command emits a DOT graph representation of Terraform dependencies, useful for spotting unexpected ordering constraints; this directly meets the requirement to display configuration and state dependencies for troubleshooting. By comparison, a resource action marked minus is intended to interpret a plan showing a resource that Terraform will destroy, which is a different task from display configuration and state dependencies for troubleshooting.
Incorrect Answers
B:Disabling refresh reduces remote reads but can hide drift and produce an inaccurate plan based on stale observations; this mechanism is useful when the job is to skip routine state refresh for a constrained preview, whereas the current scenario requires the engineer to display configuration and state dependencies for troubleshooting. These operations have different effects in the stated Terraform workflow.
C:Refresh-only planning proposes changes to Terraform state or root outputs based on remote observations, without proposing ordinary resource updates; this mechanism is useful when the job is to propose updating state or root outputs to reflect remote changes without planning infrastructure remediation, whereas the current scenario requires the engineer to display configuration and state dependencies for troubleshooting. These operations have different effects in the stated Terraform workflow.
D:terraform show can display a saved plan's actions and attributes; sensitive material may appear in machine-readable forms; this mechanism is useful when the job is to inspect the human-readable contents of a saved Terraform plan, whereas the current scenario requires the engineer to display configuration and state dependencies for troubleshooting. These operations have different effects in the stated Terraform workflow.
E:In human-readable plans, - denotes a planned destruction of a managed resource; this mechanism is useful when the job is to interpret a plan showing a resource that Terraform will destroy, whereas the current scenario requires the engineer to display configuration and state dependencies for troubleshooting. These operations have different effects in the stated Terraform workflow.