Question 1
A team proposes “Provider-defined data sources” to detect a mismatched plugin distribution package. If they proceed with that technique, which result should they anticipate instead?
- Providers retrieve object details so Terraform can compare observed infrastructure against desired configuration and prior state.
- The provider declares accepted resource arguments and computed attributes; Terraform validates configuration against that schema.
- A provider's data source reads existing data and exposes attributes without creating or destroying the queried object.
- Terraform checks downloaded provider package checksums against lock information where hashes are available.
Explanation
Correct Answer
C:Provider-defined data sources is used when an operator needs to read information from an external service without owning its lifecycle. Consequently, this choice cannot meet the separate requirement to detect a mismatched plugin distribution package. The intended action would instead require Provider integrity hashes.
Incorrect Answers
A:This behavior belongs to Provider data refresh, which helps engineers read current attributes of managed remote objects during planning rather than satisfying the separate requirement to detect a mismatched plugin distribution package. The attempted technique was Provider-defined data sources; it would instead be used to read information from an external service without owning its lifecycle, not to produce the effect associated with Provider data refresh.
B:This behavior belongs to Provider-defined resource schemas, which helps engineers determine which arguments a resource type accepts rather than satisfying the separate requirement to detect a mismatched plugin distribution package. The attempted technique was Provider-defined data sources; it would instead be used to read information from an external service without owning its lifecycle, not to produce the effect associated with Provider-defined resource schemas.
D:That outcome belongs to Provider integrity hashes, the mechanism that can detect a mismatched plugin distribution package. The question concerns the engineer’s actual proposal, Provider-defined data sources; it is directed at read information from an external service without owning its lifecycle, not that result.
Question 2
A change request asks an engineer to enforce a reusable module's own input contract. Which choice best implements the requested behavior?
- Child input variable scope
- A local value confined to its module
- Nested module output propagation
- Variable validation inside a module
Explanation
Correct Answer
D:A child module may validate its input variables using conditions and errors independent of the parent's variable definitions; this directly meets the requirement to enforce a reusable module's own input contract. By comparison, child input variable scope is intended to make a setting available inside a called module without creating a global variable, which is a different task from enforce a reusable module's own input contract.
Incorrect Answers
A:Variables declared by a child module belong to that module and receive values via the caller's module block; this mechanism is useful when the job is to make a setting available inside a called module without creating a global variable, whereas the current scenario requires the engineer to enforce a reusable module's own input contract. These operations have different effects in the stated Terraform workflow.
B:Locals live within the module where defined and cannot be referenced from another module without passing or exposing a value; this mechanism is useful when the job is to avoid assuming a local calculation is automatically visible in a parent module, whereas the current scenario requires the engineer to enforce a reusable module's own input contract. These operations have different effects in the stated Terraform workflow.
C:Each module boundary needs an output passthrough because the root cannot directly access an arbitrary grandchild's private resources; this mechanism is useful when the job is to make a value from a grandchild module visible to the root module, whereas the current scenario requires the engineer to enforce a reusable module's own input contract. These operations have different effects in the stated Terraform workflow.
Question 3
Reviewers reject “A module dependency interface” as a way to instantiate a fixed number of child module copies. Which actual behavior explains why the proposal is unsuitable?
- The count meta-argument creates numerically indexed module instances such as module.worker[0].
- Reusable modules normally declare provider requirements while callers supply provider configurations and credentials.
- Module outputs provide explicit integration points between modules without relying on child resource addresses.
- An output-to-input reference establishes a natural dependency and avoids imposing broad depends_on edges unnecessarily.
Explanation
Correct Answer
D:A module dependency interface is used when an operator needs to connect two modules by declared output and input values. Consequently, this choice cannot meet the separate requirement to instantiate a fixed number of child module copies. The intended action would instead require A module with count.
Incorrect Answers
A:That outcome belongs to A module with count, the mechanism that can instantiate a fixed number of child module copies. The question concerns the engineer’s actual proposal, A module dependency interface; it is directed at connect two modules by declared output and input values, not that result.
B:This behavior belongs to Avoiding hard-coded child credentials, which helps engineers keep authentication and deployment-specific region choices outside a reusable child module rather than satisfying the separate requirement to instantiate a fixed number of child module copies. The attempted technique was A module dependency interface; it would instead be used to connect two modules by declared output and input values, not to produce the effect associated with Avoiding hard-coded child credentials.
C:This behavior belongs to A module output reference, which helps engineers use a network module's subnet IDs inside an application module call rather than satisfying the separate requirement to instantiate a fixed number of child module copies. The attempted technique was A module dependency interface; it would instead be used to connect two modules by declared output and input values, not to produce the effect associated with A module output reference.
Question 4
A Terraform change proposal names “Apply failure recovery” to inspect state and re-plan when a provider operation fails partway through. Which outcome can reviewers attribute to that particular mechanism?
- For a normal fresh apply, Terraform plans with current provider observations unless refresh is explicitly disabled; saved plan behavior differs.
- Root output blocks expose values Terraform calculates from the applied resource graph; output display is not an access-control boundary.
- Terraform executes actions in graph order and can operate on independent nodes in parallel subject to provider and CLI limits.
- A partial apply may have changed some resources, so Terraform should refresh and build a new plan rather than blindly assuming a full rollback.
- Provider API operations use the provider's configured credentials or supported ambient authentication, not the login name in a commit.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to inspect state and re-plan when a provider operation fails partway through, so it produces the behavior described. In contrast, apply using current credentials serves a different goal: determine which identity actually performs infrastructure changes, not inspect state and re-plan when a provider operation fails partway through.
Incorrect Answers
A:The description applies to refresh during apply planning when an engineer needs to avoid applying from stale remembered attributes after remote drift; the named apply failure recovery instead handles the requirement to inspect state and re-plan when a provider operation fails partway through, so this behavior does not describe Apply failure recovery in the situation named.
B:The description applies to post-apply outputs when an engineer needs to retrieve computed identifiers that can be used by deployment automation; the named apply failure recovery instead handles the requirement to inspect state and re-plan when a provider operation fails partway through, so this behavior does not describe Apply failure recovery 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 apply failure recovery instead handles the requirement to inspect state and re-plan when a provider operation fails partway through, so this behavior does not describe Apply failure recovery in the situation named.
E:The description applies to apply using current credentials when an engineer needs to determine which identity actually performs infrastructure changes; the named apply failure recovery instead handles the requirement to inspect state and re-plan when a provider operation fails partway through, so this behavior does not describe Apply failure recovery in the situation named.
Question 5
An engineer troubleshooting a .tf configuration has a concrete implementation goal: apply extra variable assignments without adding a command-line flag. What is the most appropriate Terraform mechanism?
- A variable default value
- A required input variable
- An auto-loaded .auto.tfvars file
- A root output block
Explanation
Correct Answer
C:Files ending in .auto.tfvars or .auto.tfvars.json are automatically loaded as root-module input values; this directly meets the requirement to apply extra variable assignments without adding a command-line flag. By comparison, a variable default value is intended to make a module input optional for callers using a common baseline, which is a different task from apply extra variable assignments without adding a command-line flag.
Incorrect Answers
A:The default argument supplies a value when the caller provides no other assignment for that variable; this mechanism is useful when the job is to make a module input optional for callers using a common baseline, whereas the current scenario requires the engineer to apply extra variable assignments without adding a command-line flag. These operations have different effects in the stated Terraform workflow.
B: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 apply extra variable assignments without adding a command-line flag. These operations have different effects in the stated Terraform workflow.
D: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 apply extra variable assignments without adding a command-line flag. These operations have different effects in the stated Terraform workflow.
Question 6
A configuration review for an application stack requires a way to resolve a graph where two resources each depend on the other. Which Terraform approach most directly fulfills that request?
- The resource address format
- each.key
- Avoiding dependency cycles
- A for_each instance address
Explanation
Correct Answer
C:Terraform cannot order a cycle of dependencies; restructure references or resource design to remove the circular edge; this directly meets the requirement to resolve a graph where two resources each depend on the other. By comparison, the resource address format is intended to identify a resource instance by its type and local name, which is a different task from resolve a graph where two resources each depend on the other.
Incorrect Answers
A:A resource address inside a module ordinarily uses TYPE.NAME, with optional instance indexing when count or for_each is used; this mechanism is useful when the job is to identify a resource instance by its type and local name, whereas the current scenario requires the engineer to resolve a graph where two resources each depend on the other. These operations have different effects in the stated Terraform workflow.
B:In a for_each resource block, each.key identifies the current map key or set element for that instance; this mechanism is useful when the job is to refer to the stable key of a for_each resource instance, whereas the current scenario requires the engineer to resolve a graph where two resources each depend on the other. These operations have different effects in the stated Terraform workflow.
D:Instances made from a map or string set have addresses such as aws_instance.web["blue"], rather than an integer count index; this mechanism is useful when the job is to identify a single managed object selected by a string key, whereas the current scenario requires the engineer to resolve a graph where two resources each depend on the other. These operations have different effects in the stated Terraform workflow.
Question 7
A Terraform reviewer encounters “A refreshed missing resource” while assessing how to understand why Terraform proposes creating a managed object deleted outside the workflow. Which statement correctly describes its actual behavior?
- If a provider reports a tracked object no longer exists, a normal plan generally proposes recreating it when its resource block remains.
- The lifecycle ignore_changes rule suppresses post-creation update plans for selected attributes while leaving other attributes managed.
- The state pull command retrieves state from the configured backend and prints a snapshot that may contain secrets.
- Refresh-only apply can update the recorded state to match observed remote attributes without modifying cloud resources.
- State metadata such as lineage and serial helps protect against incompatible or stale state updates.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to understand why Terraform proposes creating a managed object deleted outside the workflow, so it produces the behavior described. In contrast, ignore_changes for shared ownership serves a different goal: stop Terraform from overwriting a field delegated to an external controller, not understand why Terraform proposes creating a managed object deleted outside the workflow.
Incorrect Answers
B:The description applies to ignore_changes for shared ownership when an engineer needs to stop Terraform from overwriting a field delegated to an external controller; the named a refreshed missing resource instead handles the requirement to understand why Terraform proposes creating a managed object deleted outside the workflow, so this behavior does not describe A refreshed missing resource in the situation named.
C:The description applies to terraform state pull when an engineer needs to obtain the current state snapshot for inspection or controlled backup; the named a refreshed missing resource instead handles the requirement to understand why Terraform proposes creating a managed object deleted outside the workflow, so this behavior does not describe A refreshed missing resource in the situation named.
D:The description applies to terraform apply -refresh-only when an engineer needs to accept current remote readings into Terraform's state through an apply operation; the named a refreshed missing resource instead handles the requirement to understand why Terraform proposes creating a managed object deleted outside the workflow, so this behavior does not describe A refreshed missing resource in the situation named.
E: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 a refreshed missing resource instead handles the requirement to understand why Terraform proposes creating a managed object deleted outside the workflow, so this behavior does not describe A refreshed missing resource in the situation named.
Question 8
An engineer troubleshooting a .tf configuration needs to wait for prerequisite objects before considering resources in another module. Which feature or operation is the most direct match?
- prevent_destroy
- Lifecycle ordering versus API support
- Resource targeting as an exception
- depends_on for module calls
- ignore_changes = all
Explanation
Correct Answer
D:A module block can declare depends_on so all managed objects inside it observe the specified dependency relationship; this directly meets the requirement to wait for prerequisite objects before considering resources in another module. By comparison, prevent_destroy is intended to reject an execution plan that deletes a protected configured object, which is a different task from wait for prerequisite objects before considering resources in another module.
Incorrect Answers
A:The lifecycle rule prevents destruction or replacement while it remains declared on the resource; removing its block removes that protection; this mechanism is useful when the job is to reject an execution plan that deletes a protected configured object, whereas the current scenario requires the engineer to wait for prerequisite objects before considering resources in another module. These operations have different effects in the stated Terraform workflow.
B:Terraform can request early replacement creation, but remote API constraints may disallow two objects with the same globally unique name; this mechanism is useful when the job is to understand why create_before_destroy can still fail on a uniquely named object, whereas the current scenario requires the engineer to wait for prerequisite objects before considering resources in another module. These operations have different effects in the stated Terraform workflow.
C:The -target option narrows an operation to selected objects and prerequisites; routine selective deployment is not its intended model; this mechanism is useful when the job is to repair an isolated broken dependency while acknowledging incomplete plan coverage, whereas the current scenario requires the engineer to wait for prerequisite objects before considering resources in another module. These operations have different effects in the stated Terraform workflow.
E:With all attributes ignored during updates, Terraform can still create and destroy the resource but does not reconcile field-level changes; this mechanism is useful when the job is to disable updates to all managed resource attributes after creation, whereas the current scenario requires the engineer to wait for prerequisite objects before considering resources in another module. These operations have different effects in the stated Terraform workflow.
Question 9
During a design review, the requirement is to use a network module's subnet IDs inside an application module call. Which option should the engineer select?
- Multiple calls to one module
- A module root directory
- Module-level depends_on
- A module output reference
Explanation
Correct Answer
D:Module outputs provide explicit integration points between modules without relying on child resource addresses; this directly meets the requirement to use a network module's subnet IDs inside an application module call. By comparison, a module root directory is intended to understand which source files Terraform loads as one module, which is a different task from use a network module's subnet IDs inside an application module call.
Incorrect Answers
A:Two module blocks that use the same source create separate module instances and separate resource addresses; this mechanism is useful when the job is to deploy two independently managed stacks from the same module definition, whereas the current scenario requires the engineer to use a network module's subnet IDs inside an application module call. These operations have different effects in the stated Terraform workflow.
B:All Terraform configuration files in a module directory are combined as one module; filenames do not define separate execution units; this mechanism is useful when the job is to understand which source files Terraform loads as one module, whereas the current scenario requires the engineer to use a network module's subnet IDs inside an application module call. These operations have different effects in the stated Terraform workflow.
C:depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency; this mechanism is useful when the job is to create an explicit ordering edge for module resources that have a real hidden dependency, whereas the current scenario requires the engineer to use a network module's subnet IDs inside an application module call. These operations have different effects in the stated Terraform workflow.
Question 10
A Terraform reviewer encounters “Environment-based provider credentials” while assessing how to avoid putting provider access tokens directly in configuration source. Which statement correctly describes its actual behavior?
- Providers can often authenticate through environment variables or identity integrations so credentials are absent from checked-in HCL.
- Provider-supported ephemeral resources exist only during an operation and can feed appropriate ephemeral consumers.
- A sensitive output is redacted in regular presentation, while JSON or raw output modes may reveal its value.
- Sensitive marks a value for redaction in UI output, but regular sensitive values can still be persisted in plan and state files.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to avoid putting provider access tokens directly in configuration source, so it produces the behavior described. In contrast, an ephemeral resource block serves a different goal: retrieve or generate temporary data that should not be persisted in Terraform state, not avoid putting provider access tokens directly in configuration source.
Incorrect Answers
B:The description applies to an ephemeral resource block when an engineer needs to retrieve or generate temporary data that should not be persisted in Terraform state; the named environment-based provider credentials instead handles the requirement to avoid putting provider access tokens directly in configuration source, so this behavior does not describe Environment-based provider credentials in the situation named.
C:The description applies to sensitive = true on an output when an engineer needs to prevent a private output from appearing in normal human-readable CLI output; the named environment-based provider credentials instead handles the requirement to avoid putting provider access tokens directly in configuration source, so this behavior does not describe Environment-based provider credentials in the situation named.
D:The description applies to sensitive = true on a variable when an engineer needs to hide a supplied secret from ordinary CLI display without removing it from state; the named environment-based provider credentials instead handles the requirement to avoid putting provider access tokens directly in configuration source, so this behavior does not describe Environment-based provider credentials in the situation named.