Question 960
A team consuming shared Terraform modules requires a way to download a community module published with an official registry address. Which Terraform approach most directly fulfills that request?
- terraform get
- A Git SSH module source
- The double-slash source subdirectory
- A public registry module source
Explanation
Correct Answer
D:Registry module sources use the namespace/name/provider address form and can support a separate version argument; this directly meets the requirement to download a community module published with an official registry address. By comparison, terraform get is intended to retrieve child modules without running the complete backend and provider setup steps, which is a different task from download a community module published with an official registry address.
Incorrect Answers
A:The terraform get command updates downloaded module sources only; routine workflows generally prefer terraform init; this mechanism is useful when the job is to retrieve child modules without running the complete backend and provider setup steps, whereas the current scenario requires the engineer to download a community module published with an official registry address. These operations have different effects in the stated Terraform workflow.
B:A git::ssh:// module source delegates repository authentication to Git and SSH rather than a Terraform registry token; this mechanism is useful when the job is to obtain module code from a repository that requires SSH-based access, whereas the current scenario requires the engineer to download a community module published with an official registry address. These operations have different effects in the stated Terraform workflow.
C:Module source syntax places //subdir after the package address to select the intended directory within the downloaded package; this mechanism is useful when the job is to use a nested module stored below a repository's root directory, whereas the current scenario requires the engineer to download a community module published with an official registry address. These operations have different effects in the stated Terraform workflow.
Question 961
A runbook lists “Workspace tags” for the task to categorize HCP Terraform workspaces for filtering or configuration selection. Which technical effect should its description include?
- Workspace settings store variables for that workspace's execution; global sets should not replace environment-specific data blindly.
- A project is a grouping and access construct; changing project assignment does not turn two workspaces into one state.
- Workspace tags help group and select workspaces, including when a CLI cloud block targets tagged workspace sets.
- Separate workspaces allow independent state lifecycles for services that are changed and approved separately.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to categorize HCP Terraform workspaces for filtering or configuration selection, so it produces the behavior described. In contrast, one state per independently owned system serves a different goal: avoid coupling different teams' deploys into a single state and blast radius, not categorize HCP Terraform workspaces for filtering or configuration selection.
Incorrect Answers
A:The description applies to workspace-specific variables when an engineer needs to override or tailor values used by one particular stack; the named workspace tags instead handles the requirement to categorize HCP Terraform workspaces for filtering or configuration selection, so this behavior does not describe Workspace tags in the situation named.
B:The description applies to project membership changes when an engineer needs to move a workspace to a different organizational group without merging infrastructure state; the named workspace tags instead handles the requirement to categorize HCP Terraform workspaces for filtering or configuration selection, so this behavior does not describe Workspace tags in the situation named.
D:The description applies to one state per independently owned system when an engineer needs to avoid coupling different teams' deploys into a single state and blast radius; the named workspace tags instead handles the requirement to categorize HCP Terraform workspaces for filtering or configuration selection, so this behavior does not describe Workspace tags in the situation named.
Question 962
A review policy permits developers to plan changes but reserves execution for authorized operators following approval. Which Terraform workflow control most directly enforces that separation?
- Separate plan and apply privileges
- Write configuration first
- Iterate after feedback
- Check infrastructure after apply
- Review a plan before apply
Explanation
Correct Answer
A:Teams can make planning a review step and reserve apply execution for an authorized operator or HCP Terraform run; this directly meets the requirement to require approval before an infrastructure change executes. By comparison, iterate after feedback is intended to modify and re-plan after a change request is rejected, which is a different task from require approval before an infrastructure change executes.
Incorrect Answers
B:The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage; this mechanism is useful when the job is to express the intended infrastructure before asking Terraform for a plan, whereas the current scenario requires the engineer to require approval before an infrastructure change executes. These operations have different effects in the stated Terraform workflow.
C:A revised configuration must be planned again because a prior plan does not automatically incorporate later edits; this mechanism is useful when the job is to modify and re-plan after a change request is rejected, whereas the current scenario requires the engineer to require approval before an infrastructure change executes. These operations have different effects in the stated Terraform workflow.
D:Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift; this concerns the task to confirm deployed outputs and state match the expected result, not the current need to require approval before an infrastructure change executes. A Separate plan and apply privileges approach is appropriate here; the substituted Check infrastructure after apply option does not supply the specified Terraform capability.
E:Review a plan before apply is designed to inspect predicted create, update and delete actions prior to making changes, rather than require approval before an infrastructure change executes. Its normal effect is that the plan stage compares desired configuration with observed resource state and shows the proposed operations for review.
Question 963
An engineer intends to change a tracked object's resource address after an intentional refactor and is reviewing “terraform state mv”. What consequence follows from using it as intended?
- State pull reads the current snapshot to standard output, including potentially sensitive provider attributes.
- The JSON representation supports automated inspection but must be protected because redacted display is not a security boundary.
- The state list subcommand prints stored addresses without changing infrastructure or state content.
- State mv updates address mapping within state and does not move the real infrastructure object between regions or accounts.
- State show presents one resource's stored attributes in human-readable form and may reveal secret values.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to change a tracked object's resource address after an intentional refactor, so it produces the behavior described. In contrast, terraform show -json serves a different goal: read plan or state information in a structured representation, not change a tracked object's resource address after an intentional refactor.
Incorrect Answers
A:The description applies to terraform state pull when an engineer needs to export a state snapshot from the configured backend for careful examination; the named terraform state mv instead handles the requirement to change a tracked object's resource address after an intentional refactor, so this behavior does not describe terraform state mv in the situation named.
B:The description applies to terraform show -json when an engineer needs to read plan or state information in a structured representation; the named terraform state mv instead handles the requirement to change a tracked object's resource address after an intentional refactor, so this behavior does not describe terraform state mv in the situation named.
C:The description applies to terraform state list when an engineer needs to enumerate managed resource instance addresses in the current state; the named terraform state mv instead handles the requirement to change a tracked object's resource address after an intentional refactor, so this behavior does not describe terraform state mv in the situation named.
E:The description applies to terraform state show ADDRESS when an engineer needs to view attributes for a specified state-tracked resource instance; the named terraform state mv instead handles the requirement to change a tracked object's resource address after an intentional refactor, so this behavior does not describe terraform state mv in the situation named.
Question 964
A Terraform reviewer encounters “prevent_destroy” while assessing how to reject an execution plan that deletes a protected configured object. Which statement correctly describes its actual behavior?
- Using the network object's ID in the subnet argument automatically creates a dependency edge in the graph.
- The lifecycle rule prevents destruction or replacement while it remains declared on the resource; removing its block removes that protection.
- A terraform_data resource can expose input-related lifecycle actions for replace_triggered_by, which expects managed resource changes.
- The depends_on edge can relate the whole counted resource block to an upstream resource, rather than computing one edge by list position.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to reject an execution plan that deletes a protected configured object, so it produces the behavior described. In contrast, count and depends_on together serves a different goal: make multiple resource instances wait for a shared prerequisite, not reject an execution plan that deletes a protected configured object.
Incorrect Answers
A:The description applies to an implicit dependency through an ID when an engineer needs to make a subnet wait for the network resource it references; the named prevent_destroy instead handles the requirement to reject an execution plan that deletes a protected configured object, so this behavior does not describe prevent_destroy in the situation named.
C:The description applies to terraform_data as a replacement trigger when an engineer needs to trigger replacement from a plain variable value change; the named prevent_destroy instead handles the requirement to reject an execution plan that deletes a protected configured object, so this behavior does not describe prevent_destroy in the situation named.
D:The description applies to count and depends_on together when an engineer needs to make multiple resource instances wait for a shared prerequisite; the named prevent_destroy instead handles the requirement to reject an execution plan that deletes a protected configured object, so this behavior does not describe prevent_destroy in the situation named.
Question 965
During one infrastructure delivery, the team must satisfy all of the following: (1) understand which provider settings a child module can use from its parent; (2) use a network module's subnet IDs inside an application module call. Select TWO appropriate Terraform approaches. Choose TWO.
- Provider configuration inheritance
- Using a module registry version
- Child input variable scope
- Avoiding hard-coded child credentials
- A module output reference
- Nested module output propagation
Explanation
Correct Answers
A:Default provider configurations can be inherited, while alternate aliases need explicit mapping and declared configuration aliases; this meets the requirement to understand which provider settings a child module can use from its parent, while the other selected techniques address use a network module's subnet IDs inside an application module call, which require their own distinct Terraform mechanisms.
E:Module outputs provide explicit integration points between modules without relying on child resource addresses; this meets the requirement to use a network module's subnet IDs inside an application module call, while the other selected techniques address understand which provider settings a child module can use from its parent, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings; it addresses control which published module release a root configuration consumes, but this delivery instead requires understand which provider settings a child module can use from its parent and use a network module's subnet IDs inside an application module call. The required combination involves Provider configuration inheritance and A module output reference, not the behavior of Using a module registry version.
C:Variables declared by a child module belong to that module and receive values via the caller's module block; it addresses make a setting available inside a called module without creating a global variable, but this delivery instead requires understand which provider settings a child module can use from its parent and use a network module's subnet IDs inside an application module call. The required combination involves Provider configuration inheritance and A module output reference, not the behavior of Child input variable scope.
D:Reusable modules normally declare provider requirements while callers supply provider configurations and credentials; it addresses keep authentication and deployment-specific region choices outside a reusable child module, but this delivery instead requires understand which provider settings a child module can use from its parent and use a network module's subnet IDs inside an application module call. The required combination involves Provider configuration inheritance and A module output reference, not the behavior of Avoiding hard-coded child credentials.
F:Each module boundary needs an output passthrough because the root cannot directly access an arbitrary grandchild's private resources; it addresses make a value from a grandchild module visible to the root module, but this delivery instead requires understand which provider settings a child module can use from its parent and use a network module's subnet IDs inside an application module call. The required combination involves Provider configuration inheritance and A module output reference, not the behavior of Nested module output propagation.
Question 966
A change request asks an engineer to avoid downloading child modules during a narrowly scoped initialization. Which choice best implements the requested behavior?
- terraform init -migrate-state
- terraform init -get=false
- The .terraform.lock.hcl file
- Provider source change reinitialization
- Repeatable initialization
Explanation
Correct Answer
B:The get=false switch skips child module installation, which is generally safe only if module dependencies are already present; this directly meets the requirement to avoid downloading child modules during a narrowly scoped initialization. By comparison, terraform init -migrate-state is intended to move existing state to a newly configured backend, which is a different task from avoid downloading child modules during a narrowly scoped initialization.
Incorrect Answers
A:The migrate-state flag attempts to copy prior state into the new backend and can prompt for migration confirmation; this mechanism is useful when the job is to move existing state to a newly configured backend, whereas the current scenario requires the engineer to avoid downloading child modules during a narrowly scoped initialization. These operations have different effects in the stated Terraform workflow.
C: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 avoid downloading child modules during a narrowly scoped initialization. These operations have different effects in the stated Terraform workflow.
D:A modified provider requirement can trigger a need to rerun init to resolve the newly declared plugin dependency; this mechanism is useful when the job is to respond after changing the source address of a required provider, whereas the current scenario requires the engineer to avoid downloading child modules during a narrowly scoped initialization. These operations have different effects in the stated Terraform workflow.
E:terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup; this mechanism is useful when the job is to run initialization again in an already prepared directory without unnecessary changes, whereas the current scenario requires the engineer to avoid downloading child modules during a narrowly scoped initialization. These operations have different effects in the stated Terraform workflow.
Question 967
The team evaluates “Preventing credential leaks in plans” for a requirement to avoid sharing a plan artifact publicly just because console values appear redacted. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- Saved plan files may contain sensitive values and must be handled as confidential artifacts rather than safe public summaries.
- Base64 is reversible encoding; exposing encoded credentials in configuration or state still risks disclosure.
- Terraform does not permit ephemeral = true on root-module output blocks, because their ordinary purpose is persistent presentation.
- Provider-defined write-only arguments introduced in Terraform 1.11 are available only when the resource schema supports them.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to avoid sharing a plan artifact publicly just because console values appear redacted, so it produces the behavior described. In contrast, not treating Base64 as secrecy serves a different goal: recognize that an encoded password remains sensitive information, not avoid sharing a plan artifact publicly just because console values appear redacted.
Incorrect Answers
B:The description applies to not treating Base64 as secrecy when an engineer needs to recognize that an encoded password remains sensitive information; the named preventing credential leaks in plans instead handles the requirement to avoid sharing a plan artifact publicly just because console values appear redacted, so this behavior does not describe Preventing credential leaks in plans in the situation named.
C:The description applies to no ephemeral root output when an engineer needs to reject a design that tries to publish a runtime-only value through the root output table; the named preventing credential leaks in plans instead handles the requirement to avoid sharing a plan artifact publicly just because console values appear redacted, so this behavior does not describe Preventing credential leaks in plans in the situation named.
D:The description applies to a write-only resource argument when an engineer needs to pass a secret to a resource without persisting that argument's value; the named preventing credential leaks in plans instead handles the requirement to avoid sharing a plan artifact publicly just because console values appear redacted, so this behavior does not describe Preventing credential leaks in plans in the situation named.
Question 968
During one infrastructure delivery, the team must satisfy all of the following: (1) declare where a provider plugin comes from and which versions are acceptable; (2) avoid exposing full state when another stack only needs a published identifier. Select TWO appropriate Terraform approaches. Choose TWO.
- The required_providers block
- Remote state sharing boundaries
- A provider mirror
- The state serial number
- State resource addresses
Explanation
Correct Answers
A:A required_providers entry maps a local provider name to its source address and version constraint; it does not configure API credentials; this meets the requirement to declare where a provider plugin comes from and which versions are acceptable, while the other selected techniques address avoid exposing full state when another stack only needs a published identifier, which require their own distinct Terraform mechanisms.
B:Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure; this meets the requirement to avoid exposing full state when another stack only needs a published identifier, while the other selected techniques address declare where a provider plugin comes from and which versions are acceptable, which require their own distinct Terraform mechanisms.
Incorrect Answers
C:A CLI provider_installation configuration can direct provider package discovery to a network or filesystem mirror; it addresses install approved plugins from an internal distribution location, but this delivery instead requires declare where a provider plugin comes from and which versions are acceptable and avoid exposing full state when another stack only needs a published identifier. The required combination involves The required_providers block and Remote state sharing boundaries, not the behavior of A provider mirror.
D:State metadata includes lineage and serial information that helps Terraform identify state history and updates; it addresses understand how successive snapshots are ordered, but this delivery instead requires declare where a provider plugin comes from and which versions are acceptable and avoid exposing full state when another stack only needs a published identifier. The required combination involves The required_providers block and Remote state sharing boundaries, not the behavior of The state serial number.
E:State maps Terraform instance addresses to remote object identifiers and remembered attributes for subsequent comparisons; it addresses identify which remote object corresponds to a particular configuration resource, but this delivery instead requires declare where a provider plugin comes from and which versions are acceptable and avoid exposing full state when another stack only needs a published identifier. The required combination involves The required_providers block and Remote state sharing boundaries, not the behavior of State resource addresses.
Question 969
An engineering checklist calls for separate outcomes: (1) control which published module release a root configuration consumes; (2) enforce a reusable module's own input contract. Which TWO options implement the requested outcomes? Choose TWO.
- Using a module registry version
- A module with for_each
- Nested module output propagation
- Variable validation inside a module
- Avoiding hard-coded child credentials
Explanation
Correct Answers
A:The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings; this meets the requirement to control which published module release a root configuration consumes, while the other selected techniques address enforce a reusable module's own input contract, which require their own distinct Terraform mechanisms.
D:A child module may validate its input variables using conditions and errors independent of the parent's variable definitions; this meets the requirement to enforce a reusable module's own input contract, while the other selected techniques address control which published module release a root configuration consumes, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:The for_each meta-argument instantiates keyed module instances addressable as module.NAME["key"]; it addresses create one child module instance for each stable application key, but this delivery instead requires control which published module release a root configuration consumes and enforce a reusable module's own input contract. The required combination involves Variable validation inside a module and Using a module registry version, not the behavior of A module with for_each.
C:Each module boundary needs an output passthrough because the root cannot directly access an arbitrary grandchild's private resources; it addresses make a value from a grandchild module visible to the root module, but this delivery instead requires control which published module release a root configuration consumes and enforce a reusable module's own input contract. The required combination involves Variable validation inside a module and Using a module registry version, not the behavior of Nested module output propagation.
E:Reusable modules normally declare provider requirements while callers supply provider configurations and credentials; it addresses keep authentication and deployment-specific region choices outside a reusable child module, but this delivery instead requires control which published module release a root configuration consumes and enforce a reusable module's own input contract. The required combination involves Variable validation inside a module and Using a module registry version, not the behavior of Avoiding hard-coded child credentials.
Question 970
A module author evaluates the expression jsonencode({enabled=true}) with the literal inputs shown. What is the resulting Terraform value?
- "{\"enabled\":\"true\"}" (JSON string property)
- "enabled=true" (raw assignment notation)
- {enabled=true} (unencoded HCL object)
- "{\"enabled\":true}" (JSON boolean property)
Explanation
Correct Answer
D:The expression jsonencode({enabled=true}) evaluates to "{\"enabled\":true}" because jsonencode serializes the object as a JSON string with a boolean true value. This is Terraform's direct evaluation of the supplied literal arguments in jsonencode({enabled=true}), not an external provider lookup.
Incorrect Answers
A:The value is a JSON boolean, not a quoted string literal. In this specific evaluation, jsonencode serializes the object as a JSON string with a boolean true value, which rules out the proposed alternative.
B:JSON requires object braces, quoted property names and a colon separator. HCL evaluates jsonencode({enabled=true}) using the supplied arguments: jsonencode serializes the object as a JSON string with a boolean true value; the listed result is therefore incorrect.
C:This is a Terraform object value, not the JSON text returned by encoding. For jsonencode({enabled=true}), jsonencode serializes the object as a JSON string with a boolean true value; consequently this candidate is not the value Terraform computes.