Question 70
A declarative resource and expression design requires a way to look up an already existing object without taking ownership of its lifecycle. Which Terraform approach most directly fulfills that request?
- Importing an existing object
- Resource removal without deletion
- A data source block
- Provider resource type prefixes
- Resource local names
Explanation
Correct Answer
C:A data block asks a provider to read information and does not make Terraform create or destroy the referenced remote object; this directly meets the requirement to look up an already existing object without taking ownership of its lifecycle. By comparison, importing an existing object is intended to bring a previously unmanaged remote object under a resource block's lifecycle, which is a different task from look up an already existing object without taking ownership of its lifecycle.
Incorrect Answers
A:Import associates a configured resource address with an existing remote object's provider identity in Terraform state; this mechanism is useful when the job is to bring a previously unmanaged remote object under a resource block's lifecycle, whereas the current scenario requires the engineer to look up an already existing object without taking ownership of its lifecycle. These operations have different effects in the stated Terraform workflow.
B:A removed block with destroy = false can express a configuration-driven removal from state while leaving the infrastructure object intact; this mechanism is useful when the job is to retain a remote object but stop Terraform from managing it, whereas the current scenario requires the engineer to look up an already existing object without taking ownership of its lifecycle. These operations have different effects in the stated Terraform workflow.
D:A resource type name usually starts with its provider local name, such as aws_instance for the AWS provider; this mechanism is useful when the job is to identify which provider implements a resource's API operations, whereas the current scenario requires the engineer to look up an already existing object without taking ownership of its lifecycle. These operations have different effects in the stated Terraform workflow.
E: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 look up an already existing object without taking ownership of its lifecycle. These operations have different effects in the stated Terraform workflow.
Question 71
A pipeline responsible for the Terraform workflow requires a way to inject partial backend settings at initialization time. Which Terraform approach most directly fulfills that request?
- terraform init -get=false
- terraform init -backend-config
- The .terraform directory
- terraform init for a new directory
- The .terraform.lock.hcl file
Explanation
Correct Answer
B:This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets; this directly meets the requirement to inject partial backend settings at initialization time. By comparison, the .terraform.lock.hcl file is intended to identify which file should be checked in to preserve selected provider packages, which is a different task from inject partial backend settings at initialization time.
Incorrect Answers
A:The get=false switch skips child module installation, which is generally safe only if module dependencies are already present; this mechanism is useful when the job is to avoid downloading child modules during a narrowly scoped initialization, whereas the current scenario requires the engineer to inject partial backend settings at initialization time. These operations have different effects in the stated Terraform workflow.
C:Terraform creates .terraform for module caches, provider installations and backend/workspace metadata; it is not a substitute for committed configuration; this mechanism is useful when the job is to identify where a working directory keeps installed modules and initialization metadata, whereas the current scenario requires the engineer to inject partial backend settings at initialization time. These operations have different effects in the stated Terraform workflow.
D: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 inject partial backend settings at initialization time. These operations have different effects in the stated Terraform workflow.
E:Terraform records provider version and checksum selections in its dependency lock file, which teams normally commit to source control; this mechanism is useful when the job is to identify which file should be checked in to preserve selected provider packages, whereas the current scenario requires the engineer to inject partial backend settings at initialization time. These operations have different effects in the stated Terraform workflow.
Question 72
During an infrastructure design review about how to set a reusable module's environment tag from the caller, a maintainer asks what “Parent-to-child argument passing” does. Which description is accurate?
- An object type lets a module enforce named configuration fields instead of accepting many untyped values.
- Default provider configurations can be inherited, while alternate aliases need explicit mapping and declared configuration aliases.
- A module block explicitly sets the child's declared input variables using arguments of matching names.
- Root variables accept runtime assignments, whereas a child module normally receives its inputs through the parent's module call.
- Each module boundary needs an output passthrough because the root cannot directly access an arbitrary grandchild's private resources.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to set a reusable module's environment tag from the caller, so it produces the behavior described. In contrast, nested module output propagation serves a different goal: make a value from a grandchild module visible to the root module, not set a reusable module's environment tag from the caller.
Incorrect Answers
A:The description applies to input object variables when an engineer needs to pass a structured settings bundle into a reusable module; the named parent-to-child argument passing instead handles the requirement to set a reusable module's environment tag from the caller, so this behavior does not describe Parent-to-child argument passing in the situation named.
B:The description applies to provider configuration inheritance when an engineer needs to understand which provider settings a child module can use from its parent; the named parent-to-child argument passing instead handles the requirement to set a reusable module's environment tag from the caller, so this behavior does not describe Parent-to-child argument passing in the situation named.
D:The description applies to root input variable scope when an engineer needs to read command-line and tfvars input values for the root module; the named parent-to-child argument passing instead handles the requirement to set a reusable module's environment tag from the caller, so this behavior does not describe Parent-to-child argument passing in the situation named.
E:The description applies to nested module output propagation when an engineer needs to make a value from a grandchild module visible to the root module; the named parent-to-child argument passing instead handles the requirement to set a reusable module's environment tag from the caller, so this behavior does not describe Parent-to-child argument passing in the situation named.
Question 73
A team compares Terraform mechanisms for the goal to limit how many graph operations execute concurrently. Which stated consequence belongs specifically to “terraform apply -parallelism”?
- A partial apply may have changed some resources, so Terraform should refresh and build a new plan rather than blindly assuming a full rollback.
- The parallelism setting controls Terraform's concurrent resource operation count, which can mitigate API throttling.
- Terraform executes actions in graph order and can operate on independent nodes in parallel subject to provider and CLI limits.
- Provider API operations use the provider's configured credentials or supported ambient authentication, not the login name in a commit.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to limit how many graph operations execute concurrently, so it produces the behavior described. In contrast, apply failure recovery serves a different goal: inspect state and re-plan when a provider operation fails partway through, not limit how many graph operations execute concurrently.
Incorrect Answers
A:The description applies to apply failure recovery when an engineer needs to inspect state and re-plan when a provider operation fails partway through; the named terraform apply -parallelism instead handles the requirement to limit how many graph operations execute concurrently, so this behavior does not describe terraform apply -parallelism in the situation named.
C:The description applies to parallel graph execution when an engineer needs to allow independent resources to be applied concurrently; the named terraform apply -parallelism instead handles the requirement to limit how many graph operations execute concurrently, so this behavior does not describe terraform apply -parallelism in the situation named.
D:The description applies to apply using current credentials when an engineer needs to determine which identity actually performs infrastructure changes; the named terraform apply -parallelism instead handles the requirement to limit how many graph operations execute concurrently, so this behavior does not describe terraform apply -parallelism in the situation named.
Question 74
A Terraform deployment has independent requirements: (1) use two unrelated service APIs in one root configuration; (2) translate Terraform resource operations into calls to the relevant remote API; (3) distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. Which THREE mechanisms directly address these needs? Choose THREE.
- Separate required provider names
- A provider source address
- configuration_aliases in required_providers
- A lower-bound provider constraint
- Provider integrity hashes
- A provider plugin
Explanation
Correct Answers
A:List both plugins under required_providers and configure each service's provider independently as needed; this meets the requirement to use two unrelated service APIs in one root configuration, while the other selected techniques address translate Terraform resource operations into calls to the relevant remote API and distinguish a community plugin from the HashiCorp-maintained plugin with the same local name, which require their own distinct Terraform mechanisms.
B:The source address identifies a provider by registry hostname, namespace and type; local names alone are insufficient to distinguish publishers; this meets the requirement to distinguish a community plugin from the HashiCorp-maintained plugin with the same local name, while the other selected techniques address use two unrelated service APIs in one root configuration and translate Terraform resource operations into calls to the relevant remote API, which require their own distinct Terraform mechanisms.
F:Providers implement resource and data-source schemas plus read, create, update and delete operations for their services; this meets the requirement to translate Terraform resource operations into calls to the relevant remote API, while the other selected techniques address use two unrelated service APIs in one root configuration and distinguish a community plugin from the HashiCorp-maintained plugin with the same local name, which require their own distinct Terraform mechanisms.
Incorrect Answers
C:A child module's required_providers entry uses configuration_aliases to advertise provider aliases referenced inside the module; it addresses declare which alternate provider configurations a child module is allowed to receive, but this delivery instead requires use two unrelated service APIs in one root configuration and translate Terraform resource operations into calls to the relevant remote API and distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. The required combination involves A provider source address and A provider plugin and Separate required provider names, not the behavior of configuration_aliases in required_providers.
D:A version requirement such as >= 5.0.0 allows matching later versions but does not cap major-version upgrades; it addresses allow provider releases no older than a tested minimum, but this delivery instead requires use two unrelated service APIs in one root configuration and translate Terraform resource operations into calls to the relevant remote API and distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. The required combination involves A provider source address and A provider plugin and Separate required provider names, not the behavior of A lower-bound provider constraint.
E:Terraform checks downloaded provider package checksums against lock information where hashes are available; it addresses detect a mismatched plugin distribution package, but this delivery instead requires use two unrelated service APIs in one root configuration and translate Terraform resource operations into calls to the relevant remote API and distinguish a community plugin from the HashiCorp-maintained plugin with the same local name. The required combination involves A provider source address and A provider plugin and Separate required provider names, not the behavior of Provider integrity hashes.
Question 75
A team compares Terraform mechanisms for the goal to guard a dependent consumer against a provider result that violates an invariant. Which stated consequence belongs specifically to “Postconditions for exported IDs”?
- Postconditions validate resultant resource or data-source attributes and prevent dependents from relying on invalid results.
- Variable validation rejects unacceptable values, whereas failed check assertions are intended for diagnostic warnings.
- Validation, precondition and postcondition definitions use error_message to tell the operator why a rule failed.
- Check assertions evaluate health expectations and normally report warning diagnostics rather than blocking deployment on a false condition.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to guard a dependent consumer against a provider result that violates an invariant, so it produces the behavior described. In contrast, the error_message field serves a different goal: present a meaningful explanation when a custom condition evaluates false, not guard a dependent consumer against a provider result that violates an invariant.
Incorrect Answers
B:The description applies to input validation versus check blocks when an engineer needs to choose a blocking input constraint rather than a monitoring-style assertion; the named postconditions for exported IDs instead handles the requirement to guard a dependent consumer against a provider result that violates an invariant, so this behavior does not describe Postconditions for exported IDs in the situation named.
C:The description applies to the error_message field when an engineer needs to present a meaningful explanation when a custom condition evaluates false; the named postconditions for exported IDs instead handles the requirement to guard a dependent consumer against a provider result that violates an invariant, so this behavior does not describe Postconditions for exported IDs in the situation named.
D:The description applies to the check block when an engineer needs to report a failed ongoing infrastructure assertion without ordinarily blocking the apply; the named postconditions for exported IDs instead handles the requirement to guard a dependent consumer against a provider result that violates an invariant, so this behavior does not describe Postconditions for exported IDs in the situation named.
Question 76
An engineering checklist calls for separate outcomes: (1) use attributes read from an existing resource when configuring a new managed object; (2) require a fixed sequence of potentially different element types. Which TWO options implement the requested outcomes? Choose TWO.
- A tuple type
- An unknown plan-time value
- Resource removal without deletion
- A data-source reference
- The null value
Explanation
Correct Answers
A:tuple([string, number]) enforces a position-specific sequence with different type constraints; this meets the requirement to require a fixed sequence of potentially different element types, while the other selected techniques address use attributes read from an existing resource when configuring a new managed object, which require their own distinct Terraform mechanisms.
D:References to data.TYPE.NAME.attribute retrieve values supplied by a read-only provider data source; this meets the requirement to use attributes read from an existing resource when configuring a new managed object, while the other selected techniques address require a fixed sequence of potentially different element types, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:An unknown value represents future information and can propagate through expressions until a provider supplies the result; it addresses identify a computed attribute that Terraform cannot determine until apply, but this delivery instead requires use attributes read from an existing resource when configuring a new managed object and require a fixed sequence of potentially different element types. The required combination involves A data-source reference and A tuple type, not the behavior of An unknown plan-time value.
C: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 use attributes read from an existing resource when configuring a new managed object and require a fixed sequence of potentially different element types. The required combination involves A data-source reference and A tuple type, not the behavior of Resource removal without deletion.
E:In supported contexts, setting an optional resource argument to null behaves like leaving that argument unset; it addresses represent the absence of an optional argument value, but this delivery instead requires use attributes read from an existing resource when configuring a new managed object and require a fixed sequence of potentially different element types. The required combination involves A data-source reference and A tuple type, not the behavior of The null value.
Question 77
A Terraform reviewer encounters “A variable description” while assessing how to document what input callers should supply when using a module. Which statement correctly describes its actual behavior?
- Terraform automatically discovers terraform.tfvars and terraform.tfvars.json in the working directory.
- The module block assigns arguments corresponding to input variables declared in the child; variables are scoped to modules.
- Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state.
- Descriptions communicate intended values to users and tooling but do not change evaluation semantics or set defaults.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to document what input callers should supply when using a module, so it produces the behavior described. In contrast, a sensitive output serves a different goal: hide a secret-like output from Terraform's usual human-readable display, not document what input callers should supply when using a module.
Incorrect Answers
A:The description applies to a terraform.tfvars file when an engineer needs to load a conventional set of root-module variable assignments automatically; the named a variable description instead handles the requirement to document what input callers should supply when using a module, so this behavior does not describe A variable description in the situation named.
B:The description applies to passing module inputs explicitly when an engineer needs to configure a child module with parent-provided values; the named a variable description instead handles the requirement to document what input callers should supply when using a module, so this behavior does not describe A variable description in the situation named.
C:The description applies to a sensitive output when an engineer needs to hide a secret-like output from Terraform's usual human-readable display; the named a variable description instead handles the requirement to document what input callers should supply when using a module, so this behavior does not describe A variable description in the situation named.
Question 78
During one infrastructure delivery, the team must satisfy all of the following: (1) allow another system to update selected attributes without Terraform reverting them; (2) use a short-lived runtime secret without saving its value in plan or state. Select TWO appropriate Terraform approaches. Choose TWO.
- Output-level depends_on
- create_before_destroy
- ignore_changes on a tag
- Remote state access controls
- ephemeral = true on a variable
Explanation
Correct Answers
C:The lifecycle ignore_changes list excludes chosen attributes from later update comparisons while creation still considers configured values; this meets the requirement to allow another system to update selected attributes without Terraform reverting them, while the other selected techniques address use a short-lived runtime secret without saving its value in plan or state, which require their own distinct Terraform mechanisms.
E:Terraform 1.10+ ephemeral variables can flow only into allowed ephemeral contexts and are omitted from persisted artifacts; this meets the requirement to use a short-lived runtime secret without saving its value in plan or state, while the other selected techniques address allow another system to update selected attributes without Terraform reverting them, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:An output block can express an explicit dependency beyond references contained in its value expression; it addresses prevent a module output from being considered ready before an additional side-effect resource, but this delivery instead requires allow another system to update selected attributes without Terraform reverting them and use a short-lived runtime secret without saving its value in plan or state. The required combination involves ignore_changes on a tag and ephemeral = true on a variable, not the behavior of Output-level depends_on.
B:This lifecycle setting changes replacement order, but requires names and quotas to permit temporary coexistence; it addresses create a replacement object before deleting the previous instance, but this delivery instead requires allow another system to update selected attributes without Terraform reverting them and use a short-lived runtime secret without saving its value in plan or state. The required combination involves ignore_changes on a tag and ephemeral = true on a variable, not the behavior of create_before_destroy.
D:Protecting state requires backend encryption, identity-based authorization and controlled access because state can store raw secret values; it addresses prevent unauthorized operators from reading sensitive resource attributes, but this delivery instead requires allow another system to update selected attributes without Terraform reverting them and use a short-lived runtime secret without saving its value in plan or state. The required combination involves ignore_changes on a tag and ephemeral = true on a variable, not the behavior of Remote state access controls.
Question 79
A change request asks an engineer to review an all-destroy plan before approving resource deletion. Which choice best implements the requested behavior?
- Resource-specific delete restrictions
- terraform plan -destroy
- terraform destroy
- An explicit prevent_destroy rule
- Dependency-aware deletion
Explanation
Correct Answer
B:Destroy planning shows the deletion proposal without carrying out the deletion until apply; this directly meets the requirement to review an all-destroy plan before approving resource deletion. By comparison, an explicit prevent_destroy rule is intended to block a destructive plan for a protected configured resource, which is a different task from review an all-destroy plan before approving resource deletion.
Incorrect Answers
A:Providers and remote APIs can reject deletion when dependencies, protection flags or permissions prevent removing the object; this mechanism is useful when the job is to diagnose why destroy fails despite valid Terraform syntax, whereas the current scenario requires the engineer to review an all-destroy plan before approving resource deletion. These operations have different effects in the stated Terraform workflow.
C:The destroy command plans and applies removal of managed objects subject to lifecycle and provider constraints; this mechanism is useful when the job is to remove the managed infrastructure described by the current Terraform configuration, whereas the current scenario requires the engineer to review an all-destroy plan before approving resource deletion. These operations have different effects in the stated Terraform workflow.
D:The lifecycle prevent_destroy setting rejects a plan that destroys or replaces a configured resource while the rule remains present; this mechanism is useful when the job is to block a destructive plan for a protected configured resource, whereas the current scenario requires the engineer to review an all-destroy plan before approving resource deletion. These operations have different effects in the stated Terraform workflow.
E:Terraform generally reverses dependency order when destroying managed resources so dependent objects are removed first; this mechanism is useful when the job is to remove dependent resources before objects they rely on, whereas the current scenario requires the engineer to review an all-destroy plan before approving resource deletion. These operations have different effects in the stated Terraform workflow.
Question 80
A Terraform reviewer encounters “State locking” while assessing how to prevent concurrent state writers from overwriting each other's updates. Which statement correctly describes its actual behavior?
- Distinct backends, workspaces or root configurations can isolate state, but the configuration must target the intended instance set.
- Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure.
- State metadata includes lineage and serial information that helps Terraform identify state history and updates.
- State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons.
- State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter.
- A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes.
Explanation
Correct Answer
F:The named mechanism is used when the objective is to prevent concurrent state writers from overwriting each other's updates, so it produces the behavior described. In contrast, state resource addresses serves a different goal: identify which remote object corresponds to a particular configuration resource, not prevent concurrent state writers from overwriting each other's updates.
Incorrect Answers
A:The description applies to separate state per environment when an engineer needs to prevent staging changes from unintentionally sharing the production state mapping; the named state locking instead handles the requirement to prevent concurrent state writers from overwriting each other's updates, so this behavior does not describe State locking in the situation named.
B: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 state locking instead handles the requirement to prevent concurrent state writers from overwriting each other's updates, so this behavior does not describe State locking in the situation named.
C:The description applies to the state serial number when an engineer needs to understand how successive snapshots are ordered; the named state locking instead handles the requirement to prevent concurrent state writers from overwriting each other's updates, so this behavior does not describe State locking in the situation named.
D:The description applies to state resource addresses when an engineer needs to identify which remote object corresponds to a particular configuration resource; the named state locking instead handles the requirement to prevent concurrent state writers from overwriting each other's updates, so this behavior does not describe State locking in the situation named.
E:The description applies to state access protection when an engineer needs to treat a Terraform state file as potentially sensitive data; the named state locking instead handles the requirement to prevent concurrent state writers from overwriting each other's updates, so this behavior does not describe State locking in the situation named.