Question 710
During an infrastructure design review about how to save a state-only refresh plan for review and later controlled application, a maintainer asks what “terraform plan -refresh-only -out=refresh.tfplan” does. Which description is accurate?
- If a provider reports a tracked object no longer exists, a normal plan generally proposes recreating it when its resource block remains.
- A refresh-only plan saved with -out previews state and root-output corrections for later apply; the plan command itself does not commit those changes.
- A removed block can intentionally forget the previous resource address without a provider delete when lifecycle destroy is false.
- State metadata such as lineage and serial helps protect against incompatible or stale state updates.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to save a state-only refresh plan for review and later controlled application, so it produces the behavior described. In contrast, a removed block with destroy=false serves a different goal: declare that a resource should leave management while its actual object is retained, not save a state-only refresh plan for review and later controlled application.
Incorrect Answers
A:The description applies to a refreshed missing resource when an engineer needs to understand why Terraform proposes creating a managed object deleted outside the workflow; the named terraform plan -refresh-only -out=refresh.tfplan instead handles the requirement to save a state-only refresh plan for review and later controlled application, so this behavior does not describe terraform plan -refresh-only in the situation named.
C:The description applies to a removed block with destroy=false when an engineer needs to declare that a resource should leave management while its actual object is retained; the named terraform plan -refresh-only -out=refresh.tfplan instead handles the requirement to save a state-only refresh plan for review and later controlled application, so this behavior does not describe terraform plan -refresh-only in the situation named.
D:The description applies to serial and lineage checks when an engineer needs to detect that a state snapshot belongs to a different history or older generation; the named terraform plan -refresh-only -out=refresh.tfplan instead handles the requirement to save a state-only refresh plan for review and later controlled application, so this behavior does not describe terraform plan -refresh-only in the situation named.
Question 711
The team evaluates “An import configuration review” for a requirement to correct provider-generated HCL rather than trusting every inferred argument. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- Generated resource declarations are a starting point and can include computed or unsuitable attributes requiring manual cleanup.
- The to argument points to an intended Terraform resource address rather than a provider account name or state backend.
- After import, planning reveals mismatches between the declared resource arguments and the discovered remote object's attributes.
- Each managed remote object should have its own appropriate resource instance address so state can map objects unambiguously.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to correct provider-generated HCL rather than trusting every inferred argument, so it produces the behavior described. In contrast, a post-import plan serves a different goal: review whether Terraform intends to change imported infrastructure unexpectedly, not correct provider-generated HCL rather than trusting every inferred argument.
Incorrect Answers
B:The description applies to an import block's to argument when an engineer needs to specify which resource instance address should receive the imported object; the named an import configuration review instead handles the requirement to correct provider-generated HCL rather than trusting every inferred argument, so this behavior does not describe An import configuration review in the situation named.
C:The description applies to a post-import plan when an engineer needs to review whether Terraform intends to change imported infrastructure unexpectedly; the named an import configuration review instead handles the requirement to correct provider-generated HCL rather than trusting every inferred argument, so this behavior does not describe An import configuration review in the situation named.
D:The description applies to separate resources for separate imports when an engineer needs to avoid attaching two remote objects to the same Terraform resource address; the named an import configuration review instead handles the requirement to correct provider-generated HCL rather than trusting every inferred argument, so this behavior does not describe An import configuration review in the situation named.
Question 712
An organization integrating Terraform with source control requires a way to avoid declaring both HCP cloud integration and a standard backend in the same root module. Which Terraform approach most directly fulfills that request?
- An API token for CLI connectivity
- Mutual exclusivity of cloud and backend
- HCP Terraform run tasks integration
- HCP Terraform VCS integration
Explanation
Correct Answer
B:Terraform does not allow simultaneous cloud and backend blocks because both would compete to control the state and execution connection; this directly meets the requirement to avoid declaring both HCP cloud integration and a standard backend in the same root module. By comparison, an API token for CLI connectivity is intended to authorize a Terraform CLI workflow to access an HCP Terraform organization, which is a different task from avoid declaring both HCP cloud integration and a standard backend in the same root module.
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 avoid declaring both HCP cloud integration and a standard backend in the same root module. These operations have different effects in the stated Terraform workflow.
C:Run tasks integrate external systems into workflow checkpoints without changing the Terraform resource graph directly; this mechanism is useful when the job is to send proposed changes to a third-party quality or security check service, whereas the current scenario requires the engineer to avoid declaring both HCP cloud integration and a standard backend in the same root module. These operations have different effects in the stated Terraform workflow.
D:A VCS-connected workspace coordinates code changes, speculative plans and controlled applies through supported repository integration; this mechanism is useful when the job is to connect reviewed repository commits to automated infrastructure plans, whereas the current scenario requires the engineer to avoid declaring both HCP cloud integration and a standard backend in the same root module. These operations have different effects in the stated Terraform workflow.
Question 713
An operations handover for an existing Terraform deployment requires a way to express the intended infrastructure before asking Terraform for a plan. Which Terraform approach most directly fulfills that request?
- Check infrastructure after apply
- Write configuration first
- Keep configuration in version control
- Separate plan and apply privileges
Explanation
Correct Answer
B:The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage; this directly meets the requirement to express the intended infrastructure before asking Terraform for a plan. By comparison, separate plan and apply privileges is intended to require approval before an infrastructure change executes, which is a different task from express the intended infrastructure before asking Terraform for a plan.
Incorrect Answers
A:Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift; this mechanism is useful when the job is to confirm deployed outputs and state match the expected result, whereas the current scenario requires the engineer to express the intended infrastructure before asking Terraform for a plan. These operations have different effects in the stated Terraform workflow.
C:Committing root module files allows the team to relate plans and runs to a specific version of intended infrastructure; this mechanism is useful when the job is to tie an approved infrastructure change to a reviewed commit, whereas the current scenario requires the engineer to express the intended infrastructure before asking Terraform for a plan. These operations have different effects in the stated Terraform workflow.
D:Teams can make planning a review step and reserve apply execution for an authorized operator or HCP Terraform run; this mechanism is useful when the job is to require approval before an infrastructure change executes, whereas the current scenario requires the engineer to express the intended infrastructure before asking Terraform for a plan. These operations have different effects in the stated Terraform workflow.
Question 714
A change request asks an engineer to show which HCL formatting edits Terraform would make. Which choice best implements the requested behavior?
- terraform fmt -recursive
- terraform fmt -diff
- Canonical HCL alignment
- Formatting versus validation
Explanation
Correct Answer
B:The diff switch displays textual differences between current file formatting and the canonical formatting result; this directly meets the requirement to show which HCL formatting edits Terraform would make. By comparison, terraform fmt -recursive is intended to format Terraform files in nested directories under a module tree, which is a different task from show which HCL formatting edits Terraform would make.
Incorrect Answers
A:The recursive switch extends formatting into subdirectories rather than limiting the operation to the current directory; this mechanism is useful when the job is to format Terraform files in nested directories under a module tree, whereas the current scenario requires the engineer to show which HCL formatting edits Terraform would make. These operations have different effects in the stated Terraform workflow.
C:The fmt operation normalizes the presentation of configuration source, not the meaning of provider API calls; this mechanism is useful when the job is to keep spacing and indentation consistent between developers, whereas the current scenario requires the engineer to show which HCL formatting edits Terraform would make. These operations have different effects in the stated Terraform workflow.
D:terraform fmt addresses canonical HCL layout while terraform validate checks whether the configuration is structurally acceptable; this mechanism is useful when the job is to distinguish style-only issues from Terraform type and schema errors, whereas the current scenario requires the engineer to show which HCL formatting edits Terraform would make. These operations have different effects in the stated Terraform workflow.
Question 715
During a design review, the requirement is to prevent a child module from silently using an unpassed alternate provider configuration. Which option should the engineer select?
- Provider-local name mapping
- No implicit child-module alias inheritance
- Explicit provider selection on data blocks
- A default provider configuration
Explanation
Correct Answer
B:Non-default provider configurations must be passed explicitly to a child module instead of assuming aliases will propagate; this directly meets the requirement to prevent a child module from silently using an unpassed alternate provider configuration. By comparison, explicit provider selection on data blocks is intended to read an object from a secondary account rather than the default account, which is a different task from prevent a child module from silently using an unpassed alternate provider configuration.
Incorrect Answers
A:The required_providers entry maps the chosen local name to a specific fully qualified provider source address; this mechanism is useful when the job is to reuse a provider whose source address differs from its short local identifier, whereas the current scenario requires the engineer to prevent a child module from silently using an unpassed alternate provider configuration. These operations have different effects in the stated Terraform workflow.
C:A data block can set provider = aws.secondary to query through an alternate provider configuration; this mechanism is useful when the job is to read an object from a secondary account rather than the default account, whereas the current scenario requires the engineer to prevent a child module from silently using an unpassed alternate provider configuration. These operations have different effects in the stated Terraform workflow.
D:An unaliased provider block configures the default instance used by matching resources that do not override provider selection; this mechanism is useful when the job is to make resources use a common account without an explicit provider argument, whereas the current scenario requires the engineer to prevent a child module from silently using an unpassed alternate provider configuration. These operations have different effects in the stated Terraform workflow.
Question 716
A Terraform module author has a concrete implementation goal: hide a secret-like output from Terraform's usual human-readable display. What is the most appropriate Terraform mechanism?
- A required input variable
- An auto-loaded .auto.tfvars file
- A sensitive output
- The -var-file option
Explanation
Correct Answer
C:Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state; this directly meets the requirement to hide a secret-like output from Terraform's usual human-readable display. By comparison, the -var-file option is intended to load a nonstandard variable file selected for one environment, which is a different task from hide a secret-like output from Terraform's usual human-readable display.
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 hide a secret-like output from Terraform's usual human-readable display. These operations have different effects in the stated Terraform workflow.
B:Files ending in .auto.tfvars or .auto.tfvars.json are automatically loaded as root-module input values; this mechanism is useful when the job is to apply extra variable assignments without adding a command-line flag, whereas the current scenario requires the engineer to hide a secret-like output from Terraform's usual human-readable display. These operations have different effects in the stated Terraform workflow.
D:The -var-file flag explicitly selects a variables file rather than relying on auto-loaded naming conventions; this mechanism is useful when the job is to load a nonstandard variable file selected for one environment, whereas the current scenario requires the engineer to hide a secret-like output from Terraform's usual human-readable display. These operations have different effects in the stated Terraform workflow.
Question 717
A team proposes “A refreshed missing resource” to change the address of a tracked object directly within state. If they proceed with that technique, which result should they anticipate instead?
- The state mv command reassigns a managed resource's address without contacting the provider to destroy the object.
- If a provider reports a tracked object no longer exists, a normal plan generally proposes recreating it when its resource block remains.
- A data block can read an external object's attributes while avoiding taking over its create-update-delete lifecycle.
- Importing attaches the remote object's identity to state; compatible configuration is still needed to avoid unwanted changes afterward.
Explanation
Correct Answer
B:A refreshed missing resource is used when an operator needs to understand why Terraform proposes creating a managed object deleted outside the workflow. Consequently, this choice cannot meet the separate requirement to change the address of a tracked object directly within state. The intended action would instead require terraform state mv.
Incorrect Answers
A:That outcome belongs to terraform state mv, the mechanism that can change the address of a tracked object directly within state. The question concerns the engineer’s actual proposal, A refreshed missing resource; it is directed at understand why Terraform proposes creating a managed object deleted outside the workflow, not that result.
C:This behavior belongs to A data source instead of import, which helps engineers refer to shared infrastructure that another stack owns without changing its lifecycle rather than satisfying the separate requirement to change the address of a tracked object directly within state. The attempted technique was A refreshed missing resource; it would instead be used to understand why Terraform proposes creating a managed object deleted outside the workflow, not to produce the effect associated with A data source instead of import.
D:This behavior belongs to A state import workflow, which helps engineers associate existing infrastructure with a newly declared Terraform resource address rather than satisfying the separate requirement to change the address of a tracked object directly within state. The attempted technique was A refreshed missing resource; it would instead be used to understand why Terraform proposes creating a managed object deleted outside the workflow, not to produce the effect associated with A state import workflow.
Question 718
A runbook lists “Separate required provider names” for the task to use two unrelated service APIs in one root configuration. Which technical effect should its description include?
- Non-default provider configurations must be passed explicitly to a child module instead of assuming aliases will propagate.
- A child module's required_providers entry uses configuration_aliases to advertise provider aliases referenced inside the module.
- The resource-level provider meta-argument selects a provider instance, not a different backend or Terraform workspace.
- List both plugins under required_providers and configure each service's provider independently as needed.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to use two unrelated service APIs in one root configuration, so it produces the behavior described. In contrast, a resource's provider meta-argument serves a different goal: route a particular managed object to the named alternate provider configuration, not use two unrelated service APIs in one root configuration.
Incorrect Answers
A:The description applies to no implicit child-module alias inheritance when an engineer needs to prevent a child module from silently using an unpassed alternate provider configuration; the named separate required provider names instead handles the requirement to use two unrelated service APIs in one root configuration, so this behavior does not describe Separate required provider names in the situation named.
B:The description applies to configuration_aliases in required_providers when an engineer needs to declare which alternate provider configurations a child module is allowed to receive; the named separate required provider names instead handles the requirement to use two unrelated service APIs in one root configuration, so this behavior does not describe Separate required provider names in the situation named.
C:The description applies to a resource's provider meta-argument when an engineer needs to route a particular managed object to the named alternate provider configuration; the named separate required provider names instead handles the requirement to use two unrelated service APIs in one root configuration, so this behavior does not describe Separate required provider names in the situation named.
Question 719
During a design review, the requirement is to explain why two unrelated resources can be planned and applied in parallel. Which option should the engineer select?
- A resource action marked tilde
- A resource action marked plus
- terraform plan -target
- terraform plan -detailed-exitcode
- The dependency graph during planning
- terraform show on a plan file
Explanation
Correct Answer
E:Terraform graph nodes can run concurrently when no dependency edge requires a particular order; this directly meets the requirement to explain why two unrelated resources can be planned and applied in parallel. By comparison, terraform plan -detailed-exitcode is intended to distinguish no changes from proposed changes in automation, which is a different task from explain why two unrelated resources can be planned and applied in parallel.
Incorrect Answers
A:In human-readable plan diffs, ~ indicates that Terraform proposes updating existing resource attributes; this mechanism is useful when the job is to identify an in-place change rather than object recreation, whereas the current scenario requires the engineer to explain why two unrelated resources can be planned and applied in parallel. These operations have different effects in the stated Terraform workflow.
B:In conventional human-readable plans, + signifies that a managed resource is proposed for creation; this mechanism is useful when the job is to interpret the leading + symbol in Terraform's plan, whereas the current scenario requires the engineer to explain why two unrelated resources can be planned and applied in parallel. These operations have different effects in the stated Terraform workflow.
C:Targeting narrows planning scope and can miss other required changes, so it is not the normal long-term workflow; this mechanism is useful when the job is to limit a recovery-oriented plan to a resource and its dependencies, whereas the current scenario requires the engineer to explain why two unrelated resources can be planned and applied in parallel. These operations have different effects in the stated Terraform workflow.
D:Detailed exit codes are 0 for no diff, 2 for a nonempty successful plan and 1 for an error; this mechanism is useful when the job is to distinguish no changes from proposed changes in automation, whereas the current scenario requires the engineer to explain why two unrelated resources can be planned and applied in parallel. These operations have different effects in the stated Terraform workflow.
F: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 explain why two unrelated resources can be planned and applied in parallel. These operations have different effects in the stated Terraform workflow.
Question 720
A reusable infrastructure definition has a concrete implementation goal: retrieve or generate temporary data that should not be persisted in Terraform state. What is the most appropriate Terraform mechanism?
- No secrets in version control
- Preventing credential leaks in plans
- An ephemeral resource block
- sensitive = true on an output
- HCP Terraform sensitive workspace variables
Explanation
Correct Answer
C:Provider-supported ephemeral resources exist only during an operation and can feed appropriate ephemeral consumers; this directly meets the requirement to retrieve or generate temporary data that should not be persisted in Terraform state. By comparison, no secrets in version control is intended to keep API keys out of committed terraform.tfvars and .tf files, which is a different task from retrieve or generate temporary data that should not be persisted in Terraform state.
Incorrect Answers
A:Secrets inserted directly into tracked configuration can leak through repository history, regardless of later state redaction; this mechanism is useful when the job is to keep API keys out of committed terraform.tfvars and .tf files, whereas the current scenario requires the engineer to retrieve or generate temporary data that should not be persisted in Terraform state. These operations have different effects in the stated Terraform workflow.
B:Saved plan files may contain sensitive values and must be handled as confidential artifacts rather than safe public summaries; this mechanism is useful when the job is to avoid sharing a plan artifact publicly just because console values appear redacted, whereas the current scenario requires the engineer to retrieve or generate temporary data that should not be persisted in Terraform state. These operations have different effects in the stated Terraform workflow.
D:A sensitive output is redacted in regular presentation, while JSON or raw output modes may reveal its value; this mechanism is useful when the job is to prevent a private output from appearing in normal human-readable CLI output, whereas the current scenario requires the engineer to retrieve or generate temporary data that should not be persisted in Terraform state. These operations have different effects in the stated Terraform workflow.
E:HCP Terraform can mark workspace variables sensitive to limit UI exposure, though sensitive flags do not replace secure state access; this mechanism is useful when the job is to avoid exposing a secret in ordinary workspace variable screens and logs, whereas the current scenario requires the engineer to retrieve or generate temporary data that should not be persisted in Terraform state. These operations have different effects in the stated Terraform workflow.