Question 700
During one infrastructure delivery, the team must satisfy all of the following: (1) remove dependent resources before objects they rely on; (2) run declarative module tests instead of only checking syntax; (3) inject partial backend settings at initialization time. Select THREE appropriate Terraform approaches. Choose THREE.
- terraform plan -destroy
- Dependency-aware deletion
- terraform validate
- terraform init -backend-config
- terraform test
- Repeatable initialization
Explanation
Correct Answers
B:Terraform generally reverses dependency order when destroying managed resources so dependent objects are removed first; this meets the requirement to remove dependent resources before objects they rely on, while the other selected techniques address run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time, which require their own distinct Terraform mechanisms.
D:This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets; this meets the requirement to inject partial backend settings at initialization time, while the other selected techniques address remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax, which require their own distinct Terraform mechanisms.
E:The Terraform test command executes defined test runs and assertions, which can exercise behavior beyond basic configuration validation; this meets the requirement to run declarative module tests instead of only checking syntax, while the other selected techniques address remove dependent resources before objects they rely on and inject partial backend settings at initialization time, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:Destroy planning shows the deletion proposal without carrying out the deletion until apply; it addresses review an all-destroy plan before approving resource deletion, but this delivery instead requires remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time. The required combination involves terraform init -backend-config and terraform test and Dependency-aware deletion, not the behavior of terraform plan -destroy.
C:The validate command checks syntax and schema consistency in an initialized configuration without obtaining a full execution plan; it addresses check that Terraform configuration is structurally valid without planning resource changes, but this delivery instead requires remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time. The required combination involves terraform init -backend-config and terraform test and Dependency-aware deletion, not the behavior of terraform validate.
F:terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup; it addresses run initialization again in an already prepared directory without unnecessary changes, but this delivery instead requires remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time. The required combination involves terraform init -backend-config and terraform test and Dependency-aware deletion, not the behavior of Repeatable initialization.
Question 701
A multi-provider deployment design requires a way to identify the publisher when providers share a type name. Which Terraform approach most directly fulfills that request?
- The provider block
- Provider integrity hashes
- The provider registry namespace
- A provider plugin
- Provider-defined data sources
Explanation
Correct Answer
C:The namespace portion of a source address separates provider publishers in the registry; this directly meets the requirement to identify the publisher when providers share a type name. By comparison, provider integrity hashes is intended to detect a mismatched plugin distribution package, which is a different task from identify the publisher when providers share a type name.
Incorrect Answers
A:A provider block can configure an endpoint, region or authentication parameters but should not carry the provider's version constraint; this mechanism is useful when the job is to configure API connection settings for an already required provider, whereas the current scenario requires the engineer to identify the publisher when providers share a type name. These operations have different effects in the stated Terraform workflow.
B:Terraform checks downloaded provider package checksums against lock information where hashes are available; this mechanism is useful when the job is to detect a mismatched plugin distribution package, whereas the current scenario requires the engineer to identify the publisher when providers share a type name. These operations have different effects in the stated Terraform workflow.
D:Providers implement resource and data-source schemas plus read, create, update and delete operations for their services; this mechanism is useful when the job is to translate Terraform resource operations into calls to the relevant remote API, whereas the current scenario requires the engineer to identify the publisher when providers share a type name. These operations have different effects in the stated Terraform workflow.
E:A provider's data source reads existing data and exposes attributes without creating or destroying the queried object; this mechanism is useful when the job is to read information from an external service without owning its lifecycle, whereas the current scenario requires the engineer to identify the publisher when providers share a type name. These operations have different effects in the stated Terraform workflow.
Question 702
A team compares Terraform mechanisms for the goal to provide environment-specific backend details at initialization rather than hard-coding them. Which stated consequence belongs specifically to “Partial backend configuration”?
- After changing backend configuration, migrate-state attempts to transfer existing state instead of starting with an empty one.
- Cloud storage policy and backend authorization decide who can obtain or mutate stored Terraform state; provider credentials alone are not sufficient.
- Using distinct backend keys or workspaces creates separate state namespaces instead of letting unrelated root configurations share one snapshot.
- Backend config arguments supplied at init time fill required values, but sensitive content can still be cached in local metadata or plans.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to provide environment-specific backend details at initialization rather than hard-coding them, 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 provide environment-specific backend details at initialization rather than hard-coding them.
Incorrect Answers
A:The description applies to terraform init -migrate-state when an engineer needs to copy a known working state's snapshot into a new configured backend; the named partial backend configuration instead handles the requirement to provide environment-specific backend details at initialization rather than hard-coding them, so this behavior does not describe Partial backend configuration in the situation named.
B:The description applies to remote backend access permissions when an engineer needs to enforce read and write privileges on the state object; the named partial backend configuration instead handles the requirement to provide environment-specific backend details at initialization rather than hard-coding them, so this behavior does not describe Partial backend configuration in the situation named.
C:The description applies to backend state key separation when an engineer needs to store different applications' state snapshots at distinct object paths; the named partial backend configuration instead handles the requirement to provide environment-specific backend details at initialization rather than hard-coding them, so this behavior does not describe Partial backend configuration in the situation named.
Question 703
A change request asks an engineer to accept patch updates within a chosen minor line. Which choice best implements the requested behavior?
- Provider registry installation
- A provider source address
- The required_version setting
- A compatible provider constraint
Explanation
Correct Answer
D:The pessimistic constraint ~> 5.3.0 admits versions at least 5.3.0 but below 5.4.0; this directly meets the requirement to accept patch updates within a chosen minor line. By comparison, a provider source address is intended to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name, which is a different task from accept patch updates within a chosen minor line.
Incorrect Answers
A:Terraform uses provider source metadata and its configured installation methods to find and install the appropriate plugin binary; this mechanism is useful when the job is to retrieve a published plugin from its declared registry source, whereas the current scenario requires the engineer to accept patch updates within a chosen minor line. These operations have different effects in the stated Terraform workflow.
B:The source address identifies a provider by registry hostname, namespace and type; local names alone are insufficient to distinguish publishers; this mechanism is useful when the job is to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name, whereas the current scenario requires the engineer to accept patch updates within a chosen minor line. These operations have different effects in the stated Terraform workflow.
C:The terraform block's required_version expression constrains which Terraform executable can operate on the configuration; this mechanism is useful when the job is to restrict the Terraform CLI version rather than a provider plugin, whereas the current scenario requires the engineer to accept patch updates within a chosen minor line. These operations have different effects in the stated Terraform workflow.
Question 704
An engineering checklist calls for separate outcomes: (1) identify a resource instance by its type and local name; (2) create a replacement object before deleting the previous instance. Which TWO options implement the requested outcomes? Choose TWO.
- An implicit attribute dependency
- create_before_destroy
- The resource address format
- Resource targeting as an exception
- each.value
Explanation
Correct Answers
B:This lifecycle setting changes replacement order, but requires names and quotas to permit temporary coexistence; this meets the requirement to create a replacement object before deleting the previous instance, while the other selected techniques address identify a resource instance by its type and local name, which require their own distinct Terraform mechanisms.
C:A resource address inside a module ordinarily uses TYPE.NAME, with optional instance indexing when count or for_each is used; this meets the requirement to identify a resource instance by its type and local name, while the other selected techniques address create a replacement object before deleting the previous instance, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:Referencing another managed resource's attribute creates an implicit dependency in Terraform's graph; it addresses ensure a dependent resource waits for the object whose ID it needs, but this delivery instead requires identify a resource instance by its type and local name and create a replacement object before deleting the previous instance. The required combination involves The resource address format and create_before_destroy, not the behavior of An implicit attribute dependency.
D:The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model; it addresses repair an isolated broken dependency while acknowledging incomplete plan coverage, but this delivery instead requires identify a resource instance by its type and local name and create a replacement object before deleting the previous instance. The required combination involves The resource address format and create_before_destroy, not the behavior of Resource targeting as an exception.
E:For a map-based for_each collection, each.value exposes the value associated with the current each.key; it addresses read the per-instance map value when iterating with for_each, but this delivery instead requires identify a resource instance by its type and local name and create a replacement object before deleting the previous instance. The required combination involves The resource address format and create_before_destroy, not the behavior of each.value.
Question 705
An engineer preparing an infrastructure rollout needs to run initialization again in an already prepared directory without unnecessary changes. Which feature or operation is the most direct match?
- Repeatable initialization
- Re-run init after a backend change
- terraform init for a new directory
- terraform init -reconfigure
Explanation
Correct Answer
A:terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup; this directly meets the requirement to run initialization again in an already prepared directory without unnecessary changes. By comparison, terraform init -reconfigure is intended to discard the previously cached backend connection without copying existing state, which is a different task from run initialization again in an already prepared directory without unnecessary changes.
Incorrect Answers
B:Terraform requires reinitialization to adopt changed backend settings before normal operations continue; this mechanism is useful when the job is to respond to a modified terraform backend block, whereas the current scenario requires the engineer to run initialization again in an already prepared directory without unnecessary changes. These operations have different effects in the stated Terraform workflow.
C:Initialization installs required providers and modules and establishes the working directory's backend configuration; this mechanism is useful when the job is to prepare a folder containing fresh .tf configuration files, whereas the current scenario requires the engineer to run initialization again in an already prepared directory without unnecessary changes. These operations have different effects in the stated Terraform workflow.
D:Reconfigure tells init to treat the supplied backend configuration as new, rather than performing a state migration; this mechanism is useful when the job is to discard the previously cached backend connection without copying existing state, whereas the current scenario requires the engineer to run initialization again in an already prepared directory without unnecessary changes. These operations have different effects in the stated Terraform workflow.
Question 706
During one infrastructure delivery, the team must satisfy all of the following: (1) avoid putting provider access tokens directly in configuration source; (2) plan to delete a previously managed object that remains in state. Select TWO appropriate Terraform approaches. Choose TWO.
- Environment-based provider credentials
- The terraform_data resource
- Vault-backed secret retrieval
- Removing a resource declaration
- Resource removal without deletion
Explanation
Correct Answers
A:Providers can often authenticate through environment variables or identity integrations so credentials are absent from checked-in HCL; this meets the requirement to avoid putting provider access tokens directly in configuration source, while the other selected techniques address plan to delete a previously managed object that remains in state, which require their own distinct Terraform mechanisms.
D:When a managed resource is absent from configuration but still tracked in state, normal planning proposes its destruction; this meets the requirement to plan to delete a previously managed object that remains in state, while the other selected techniques address avoid putting provider access tokens directly in configuration source, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:The built-in terraform_data resource can represent input changes and trigger replacement behavior without managing a cloud API resource; it addresses model a Terraform-managed lifecycle value without requiring an external service object, but this delivery instead requires avoid putting provider access tokens directly in configuration source and plan to delete a previously managed object that remains in state. The required combination involves Removing a resource declaration and Environment-based provider credentials, not the behavior of The terraform_data resource.
C:Vault can centralize secret lifecycle, policies and auditability, but provider and state-handling choices still determine whether a retrieved value is persisted; it addresses retrieve an operational credential from a dedicated secret manager rather than committing it, but this delivery instead requires avoid putting provider access tokens directly in configuration source and plan to delete a previously managed object that remains in state. The required combination involves Removing a resource declaration and Environment-based provider credentials, not the behavior of Vault-backed secret retrieval.
E:A removed block with destroy = false can express a configuration-driven removal from state while leaving the infrastructure object intact; it addresses retain a remote object but stop Terraform from managing it, but this delivery instead requires avoid putting provider access tokens directly in configuration source and plan to delete a previously managed object that remains in state. The required combination involves Removing a resource declaration and Environment-based provider credentials, not the behavior of Resource removal without deletion.
Question 707
During an infrastructure design review about how to read values explicitly declared as root outputs of the configuration, a maintainer asks what “terraform output” does. Which description is accurate?
- The output command reports root output values rather than listing every raw attribute from state.
- The show command renders state or plan content without being an apply operation.
- Workspace list shows logical Terraform workspaces, which may correspond to separate state instances depending on backend support.
- State rm deletes the state association, not the object in the external system.
- State mv updates address mapping within state and does not move the real infrastructure object between regions or accounts.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to read values explicitly declared as root outputs of the configuration, so it produces the behavior described. In contrast, terraform workspace list serves a different goal: list the workspaces available through the initialized backend, not read values explicitly declared as root outputs of the configuration.
Incorrect Answers
B:The description applies to terraform show when an engineer needs to display the current state or a saved plan in a human-readable way; the named terraform output instead handles the requirement to read values explicitly declared as root outputs of the configuration, so this behavior does not describe terraform output in the situation named.
C:The description applies to terraform workspace list when an engineer needs to list the workspaces available through the initialized backend; the named terraform output instead handles the requirement to read values explicitly declared as root outputs of the configuration, so this behavior does not describe terraform output in the situation named.
D:The description applies to terraform state rm when an engineer needs to stop tracking a resource without telling its provider to delete the remote object; the named terraform output instead handles the requirement to read values explicitly declared as root outputs of the configuration, so this behavior does not describe terraform output in the situation named.
E:The description applies to terraform state mv when an engineer needs to change a tracked object's resource address after an intentional refactor; the named terraform output instead handles the requirement to read values explicitly declared as root outputs of the configuration, so this behavior does not describe terraform output in the situation named.
Question 708
A platform team separating infrastructure deployments needs to review infrastructure differences before applying a workspace change. Which feature or operation is the most direct match?
- A VCS-connected workspace
- A CLI-driven workspace
- A run plan phase
- HCP Terraform remote state
Explanation
Correct Answer
C:HCP Terraform runs have plan stages where proposed infrastructure operations can be inspected and checked; this directly meets the requirement to review infrastructure differences before applying a workspace change. By comparison, HCP Terraform remote state is intended to store Terraform state under managed service controls rather than a local file, which is a different task from review infrastructure differences before applying a workspace change.
Incorrect Answers
A:HCP Terraform can connect a workspace to a VCS repository and create runs when relevant commits are pushed; this mechanism is useful when the job is to trigger infrastructure runs from changes in a configured version-control repository, whereas the current scenario requires the engineer to review infrastructure differences before applying a workspace change. These operations have different effects in the stated Terraform workflow.
B:A CLI workflow can send configuration from the Terraform CLI to HCP Terraform for workspace runs; this mechanism is useful when the job is to upload local configuration for execution through HCP Terraform rather than relying on Git webhooks, whereas the current scenario requires the engineer to review infrastructure differences before applying a workspace change. These operations have different effects in the stated Terraform workflow.
D:HCP Terraform maintains workspace state versions and supports collaboration without exposing a machine-local canonical state file; this mechanism is useful when the job is to store Terraform state under managed service controls rather than a local file, whereas the current scenario requires the engineer to review infrastructure differences before applying a workspace change. These operations have different effects in the stated Terraform workflow.
Question 709
A Terraform deployment has independent requirements: (1) export a state snapshot from the configured backend for careful examination; (2) focus verbose diagnostics on Terraform Core rather than all plugin activity; (3) avoid attaching two remote objects to the same Terraform resource address. Which THREE mechanisms directly address these needs? Choose THREE.
- Importing without creating new infrastructure
- TF_LOG_CORE
- Separate resources for separate imports
- terraform state replace-provider
- terraform state pull
- Disabling TF_LOG
Explanation
Correct Answers
B:The TF_LOG_CORE variable can control log verbosity for Core messages independently of general logging; this meets the requirement to focus verbose diagnostics on Terraform Core rather than all plugin activity, while the other selected techniques address export a state snapshot from the configured backend for careful examination and avoid attaching two remote objects to the same Terraform resource address, which require their own distinct Terraform mechanisms.
C:Each managed remote object should have its own appropriate resource instance address so state can map objects unambiguously; this meets the requirement to avoid attaching two remote objects to the same Terraform resource address, while the other selected techniques address export a state snapshot from the configured backend for careful examination and focus verbose diagnostics on Terraform Core rather than all plugin activity, which require their own distinct Terraform mechanisms.
E:State pull reads the current snapshot to standard output, including potentially sensitive provider attributes; this meets the requirement to export a state snapshot from the configured backend for careful examination, while the other selected techniques address focus verbose diagnostics on Terraform Core rather than all plugin activity and avoid attaching two remote objects to the same Terraform resource address, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:The import workflow adds an existing remote object to state and can manage it through later plans instead of creating a replacement automatically; it addresses take ownership of an existing object rather than duplicating it, but this delivery instead requires export a state snapshot from the configured backend for careful examination and focus verbose diagnostics on Terraform Core rather than all plugin activity and avoid attaching two remote objects to the same Terraform resource address. The required combination involves Separate resources for separate imports and terraform state pull and TF_LOG_CORE, not the behavior of Importing without creating new infrastructure.
D:Replace-provider rewrites provider source references in state and creates a backup before the edit; it addresses update the provider source address recorded for affected state resources, but this delivery instead requires export a state snapshot from the configured backend for careful examination and focus verbose diagnostics on Terraform Core rather than all plugin activity and avoid attaching two remote objects to the same Terraform resource address. The required combination involves Separate resources for separate imports and terraform state pull and TF_LOG_CORE, not the behavior of terraform state replace-provider.
F:Unsetting or disabling Terraform's TF_LOG environment setting removes extra diagnostic verbosity from later commands; it addresses return a shell session to ordinary Terraform logging after investigation, but this delivery instead requires export a state snapshot from the configured backend for careful examination and focus verbose diagnostics on Terraform Core rather than all plugin activity and avoid attaching two remote objects to the same Terraform resource address. The required combination involves Separate resources for separate imports and terraform state pull and TF_LOG_CORE, not the behavior of Disabling TF_LOG.
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.