Question 1030
An engineer troubleshooting a .tf configuration needs to retain a remote object but stop Terraform from managing it. Which feature or operation is the most direct match?
- Resource removal without deletion
- A data-source reference
- A resource attribute reference
- Removing a resource declaration
- A data source that depends on a resource
Explanation
Correct Answer
A:A removed block with destroy = false can express a configuration-driven removal from state while leaving the infrastructure object intact; this directly meets the requirement to retain a remote object but stop Terraform from managing it. By comparison, a data source that depends on a resource is intended to delay a lookup until a prerequisite object is available, which is a different task from retain a remote object but stop Terraform from managing it.
Incorrect Answers
B:References to data.TYPE.NAME.attribute retrieve values supplied by a read-only provider data source; this mechanism is useful when the job is to use attributes read from an existing resource when configuring a new managed object, whereas the current scenario requires the engineer to retain a remote object but stop Terraform from managing it. These operations have different effects in the stated Terraform workflow.
C:References like aws_vpc.main.id use a managed resource's attributes and create an implicit dependency; this mechanism is useful when the job is to pass a newly managed object's computed identifier to a dependent resource, whereas the current scenario requires the engineer to retain a remote object but stop Terraform from managing it. These operations have different effects in the stated Terraform workflow.
D:When a managed resource is absent from configuration but still tracked in state, normal planning proposes its destruction; this mechanism is useful when the job is to plan to delete a previously managed object that remains in state, whereas the current scenario requires the engineer to retain a remote object but stop Terraform from managing it. These operations have different effects in the stated Terraform workflow.
E:Data source reads can be deferred during planning when their inputs depend on values not known until apply; this mechanism is useful when the job is to delay a lookup until a prerequisite object is available, whereas the current scenario requires the engineer to retain a remote object but stop Terraform from managing it. These operations have different effects in the stated Terraform workflow.
Question 1031
An engineer intends to confirm that a held lock is stale before attempting manual removal and is reviewing “Lock ownership verification”. What consequence follows from using it as intended?
- HCP Terraform coordinates workspace runs and state handling, reducing conflicts among collaborating operators.
- Terraform obtains and releases supported backend locks around state-sensitive operations; a crash can sometimes leave manual recovery necessary.
- A state backend with locking helps serialize competing changes, complemented by pipeline approval and run coordination.
- A lock may belong to another active run, so check its identity and run status rather than immediately forcing removal.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to confirm that a held lock is stale before attempting manual removal, so it produces the behavior described. In contrast, state consistency during CI serves a different goal: keep two pipelines from changing the same infrastructure state simultaneously, not confirm that a held lock is stale before attempting manual removal.
Incorrect Answers
A:The description applies to HCP Terraform run serialization when an engineer needs to avoid multiple infrastructure applies targeting the same shared HCP workspace state; the named lock ownership verification instead handles the requirement to confirm that a held lock is stale before attempting manual removal, so this behavior does not describe Lock ownership verification in the situation named.
B:The description applies to lock release after completion when an engineer needs to understand why a normal Terraform operation frees the lock; the named lock ownership verification instead handles the requirement to confirm that a held lock is stale before attempting manual removal, so this behavior does not describe Lock ownership verification in the situation named.
C:The description applies to state consistency during CI when an engineer needs to keep two pipelines from changing the same infrastructure state simultaneously; the named lock ownership verification instead handles the requirement to confirm that a held lock is stale before attempting manual removal, so this behavior does not describe Lock ownership verification in the situation named.
Question 1032
An engineer proposes “A provider plugin” to evaluate HCL expressions and calculate a resource dependency graph. Which outcome does the proposed technique actually provide?
- The provider declares accepted resource arguments and computed attributes; Terraform validates configuration against that schema.
- Providers implement resource and data-source schemas plus read, create, update and delete operations for their services.
- Terraform Core handles language evaluation, planning and state orchestration while provider plugins execute service-specific operations.
- Version constraints and a shared lock file reduce unintended schema and behavior changes between deployments.
Explanation
Correct Answer
B:A provider plugin is used when an operator needs to translate Terraform resource operations into calls to the relevant remote API. Consequently, this choice cannot meet the separate requirement to evaluate HCL expressions and calculate a resource dependency graph. The intended action would instead require Terraform Core.
Incorrect Answers
A: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 evaluate HCL expressions and calculate a resource dependency graph. The attempted technique was A provider plugin; it would instead be used to translate Terraform resource operations into calls to the relevant remote API, not to produce the effect associated with Provider-defined resource schemas.
C:That outcome belongs to Terraform Core, the mechanism that can evaluate HCL expressions and calculate a resource dependency graph. The question concerns the engineer’s actual proposal, A provider plugin; it is directed at translate Terraform resource operations into calls to the relevant remote API, not that result.
D:This behavior belongs to Provider version compatibility, which helps engineers prevent incompatible provider upgrades from affecting resource handling rather than satisfying the separate requirement to evaluate HCL expressions and calculate a resource dependency graph. The attempted technique was A provider plugin; it would instead be used to translate Terraform resource operations into calls to the relevant remote API, not to produce the effect associated with Provider version compatibility.
Question 1033
A Terraform reviewer encounters “The distinct function” while assessing how to remove repeated list values while keeping each value's first occurrence. Which statement correctly describes its actual behavior?
- base64encode applies a reversible encoding and should not be mistaken for encryption of secrets.
- cidrhost computes a host address inside the given prefix from a numeric host index.
- distinct returns a list with duplicates removed and retains the ordering of the first occurrence of each element.
- upper transforms the letters of a string into uppercase without changing its underlying Terraform type.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to remove repeated list values while keeping each value's first occurrence, so it produces the behavior described. In contrast, the cidrhost function serves a different goal: calculate an IP address at an offset within a CIDR range, not remove repeated list values while keeping each value's first occurrence.
Incorrect Answers
A:The description applies to the base64encode function when an engineer needs to turn ordinary string content into Base64 text; the named the distinct function instead handles the requirement to remove repeated list values while keeping each value's first occurrence, so this behavior does not describe The distinct function in the situation named.
B:The description applies to the cidrhost function when an engineer needs to calculate an IP address at an offset within a CIDR range; the named the distinct function instead handles the requirement to remove repeated list values while keeping each value's first occurrence, so this behavior does not describe The distinct function in the situation named.
D:The description applies to the upper function when an engineer needs to convert an environment label to uppercase; the named the distinct function instead handles the requirement to remove repeated list values while keeping each value's first occurrence, so this behavior does not describe The distinct function in the situation named.
Question 1034
The team evaluates “Noninteractive apply settings” for a requirement to run Terraform in automation where prompting is not acceptable. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- The -input=false option prevents prompts for missing input, requiring all necessary values and approvals to be handled by automation.
- The auto-approve option allows the automatically created plan to proceed without interactive confirmation, so pipeline safeguards matter.
- Provider API operations use the provider's configured credentials or supported ambient authentication, not the login name in a commit.
- Terraform executes actions in graph order and can operate on independent nodes in parallel subject to provider and CLI limits.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to run Terraform in automation where prompting is not acceptable, so it produces the behavior described. In contrast, terraform apply -auto-approve serves a different goal: suppress Terraform's normal approval prompt in a controlled pipeline, not run Terraform in automation where prompting is not acceptable.
Incorrect Answers
B:The description applies to terraform apply -auto-approve when an engineer needs to suppress Terraform's normal approval prompt in a controlled pipeline; the named noninteractive apply settings instead handles the requirement to run Terraform in automation where prompting is not acceptable, so this behavior does not describe Noninteractive apply settings in the situation named.
C:The description applies to apply using current credentials when an engineer needs to determine which identity actually performs infrastructure changes; the named noninteractive apply settings instead handles the requirement to run Terraform in automation where prompting is not acceptable, so this behavior does not describe Noninteractive apply settings in the situation named.
D:The description applies to parallel graph execution when an engineer needs to allow independent resources to be applied concurrently; the named noninteractive apply settings instead handles the requirement to run Terraform in automation where prompting is not acceptable, so this behavior does not describe Noninteractive apply settings in the situation named.
Question 1035
A team compares Terraform mechanisms for the goal to make Terraform execute the planned operations against managed infrastructure. Which stated consequence belongs specifically to “terraform apply”?
- The -var-file option loads values from an input variables file, enabling separate environment assignments.
- Applying a configuration obtains a plan, requests approval when appropriate and invokes provider operations to change objects and state.
- Terraform executes actions in graph order and can operate on independent nodes in parallel subject to provider and CLI limits.
- Root output blocks expose values Terraform calculates from the applied resource graph; output display is not an access-control boundary.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to make Terraform execute the planned operations against managed infrastructure, so it produces the behavior described. In contrast, apply with a .tfvars file serves a different goal: supply a named collection of input assignments to Terraform, not make Terraform execute the planned operations against managed infrastructure.
Incorrect Answers
A:The description applies to apply with a .tfvars file when an engineer needs to supply a named collection of input assignments to Terraform; the named terraform apply instead handles the requirement to make Terraform execute the planned operations against managed infrastructure, so this behavior does not describe terraform apply 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 instead handles the requirement to make Terraform execute the planned operations against managed infrastructure, so this behavior does not describe terraform apply in the situation named.
D:The description applies to post-apply outputs when an engineer needs to retrieve computed identifiers that can be used by deployment automation; the named terraform apply instead handles the requirement to make Terraform execute the planned operations against managed infrastructure, so this behavior does not describe terraform apply in the situation named.
Question 1036
A state migration and recovery exercise requires a way to associate existing infrastructure with a newly declared Terraform resource address. Which Terraform approach most directly fulfills that request?
- A removed block with destroy=false
- A refreshed missing resource
- A normal plan with drift
- Serial and lineage checks
- A state import workflow
Explanation
Correct Answer
E:Importing attaches the remote object's identity to state; compatible configuration is still needed to avoid unwanted changes afterward; this directly meets the requirement to associate existing infrastructure with a newly declared Terraform resource address. By comparison, a removed block with destroy=false is intended to declare that a resource should leave management while its actual object is retained, which is a different task from associate existing infrastructure with a newly declared Terraform resource address.
Incorrect Answers
A:A removed block can intentionally forget the previous resource address without a provider delete when lifecycle destroy is false; this mechanism is useful when the job is to declare that a resource should leave management while its actual object is retained, whereas the current scenario requires the engineer to associate existing infrastructure with a newly declared Terraform resource address. These operations have different effects in the stated Terraform workflow.
B:If a provider reports a tracked object no longer exists, a normal plan generally proposes recreating it when its resource block remains; this mechanism is useful when the job is to understand why Terraform proposes creating a managed object deleted outside the workflow, whereas the current scenario requires the engineer to associate existing infrastructure with a newly declared Terraform resource address. These operations have different effects in the stated Terraform workflow.
C:Providers refresh remote resource attributes, and planning can propose updates to bring changed objects back to declared configuration; this mechanism is useful when the job is to detect and propose correction for changes made outside Terraform, whereas the current scenario requires the engineer to associate existing infrastructure with a newly declared Terraform resource address. These operations have different effects in the stated Terraform workflow.
D:State metadata such as lineage and serial helps protect against incompatible or stale state updates; this mechanism is useful when the job is to detect that a state snapshot belongs to a different history or older generation, whereas the current scenario requires the engineer to associate existing infrastructure with a newly declared Terraform resource address. These operations have different effects in the stated Terraform workflow.
Question 1037
During one infrastructure delivery, the team must satisfy all of the following: (1) avoid confusing provider plugin selection with reusable module source selection; (2) share reusable Terraform configuration with multiple root projects. Select TWO appropriate Terraform approaches. Choose TWO.
- A Git tag pin for a module
- A separate module repository
- Provider and module version separation
- An absolute local module source
- Init after module version change
- A registry module version constraint
Explanation
Correct Answers
B:Keeping reusable child modules separately versioned allows independent adoption and maintenance by different Terraform root modules; this meets the requirement to share reusable Terraform configuration with multiple root projects, while the other selected techniques address avoid confusing provider plugin selection with reusable module source selection, which require their own distinct Terraform mechanisms.
C:Provider versions are constrained in required_providers and locked in .terraform.lock.hcl; registry modules use their module block version arguments; this meets the requirement to avoid confusing provider plugin selection with reusable module source selection, while the other selected techniques address share reusable Terraform configuration with multiple root projects, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:A Git module's ?ref= tag or commit selects a repository revision instead of a registry module version constraint; it addresses select a specific VCS module release without using a registry version argument, but this delivery instead requires avoid confusing provider plugin selection with reusable module source selection and share reusable Terraform configuration with multiple root projects. The required combination involves A separate module repository and Provider and module version separation, not the behavior of A Git tag pin for a module.
D:Terraform can load a module from a local filesystem path, though absolute paths make configurations less portable; it addresses call a child module from an explicit filesystem path, but this delivery instead requires avoid confusing provider plugin selection with reusable module source selection and share reusable Terraform configuration with multiple root projects. The required combination involves A separate module repository and Provider and module version separation, not the behavior of An absolute local module source.
E:Changing a module source or version constraint requires reinitializing to resolve the updated selection; it addresses install a newly allowed child module release after editing its version requirement, but this delivery instead requires avoid confusing provider plugin selection with reusable module source selection and share reusable Terraform configuration with multiple root projects. The required combination involves A separate module repository and Provider and module version separation, not the behavior of Init after module version change.
F:The module version argument accepts version constraints for registry sources and Terraform resolves compatible published releases during init; it addresses select a supported module release range from the registry, but this delivery instead requires avoid confusing provider plugin selection with reusable module source selection and share reusable Terraform configuration with multiple root projects. The required combination involves A separate module repository and Provider and module version separation, not the behavior of A registry module version constraint.
Question 1038
A Terraform module author needs to transform a collection's elements into a new list or map. Which feature or operation is the most direct match?
- The upper function
- The for expression
- The cidrhost function
- The file function
Explanation
Correct Answer
B:A for expression builds derived collection values, optionally filtering with an if clause and transforming keys or values; this directly meets the requirement to transform a collection's elements into a new list or map. By comparison, the file function is intended to read UTF-8 content already present in a local file during evaluation, which is a different task from transform a collection's elements into a new list or map.
Incorrect Answers
A:upper transforms the letters of a string into uppercase without changing its underlying Terraform type; this mechanism is useful when the job is to convert an environment label to uppercase, whereas the current scenario requires the engineer to transform a collection's elements into a new list or map. These operations have different effects in the stated Terraform workflow.
C:cidrhost computes a host address inside the given prefix from a numeric host index; this mechanism is useful when the job is to calculate an IP address at an offset within a CIDR range, whereas the current scenario requires the engineer to transform a collection's elements into a new list or map. These operations have different effects in the stated Terraform workflow.
D:file reads existing local text; it does not wait for a provisioner to create the file during apply; this mechanism is useful when the job is to read UTF-8 content already present in a local file during evaluation, whereas the current scenario requires the engineer to transform a collection's elements into a new list or map. These operations have different effects in the stated Terraform workflow.
Question 1039
A team compares Terraform mechanisms for the goal to coordinate a dependent app deployment following an upstream network workspace apply. Which stated consequence belongs specifically to “HCP Terraform run triggers between workspaces”?
- Workspaces can reference separate branches or release controls while retaining isolated state for each environment.
- A run trigger can initiate a downstream plan when its designated upstream workspace completes the relevant run.
- Organizations provide a broader boundary containing projects, workspaces, teams and policy configuration.
- Variable sets can be scoped to projects to share configuration while avoiding repetitive per-workspace assignments.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to coordinate a dependent app deployment following an upstream network workspace apply, so it produces the behavior described. In contrast, environment promotion via workspaces serves a different goal: use a reviewed configuration revision across separate testing and production states, not coordinate a dependent app deployment following an upstream network workspace apply.
Incorrect Answers
A:The description applies to environment promotion via workspaces when an engineer needs to use a reviewed configuration revision across separate testing and production states; the named HCP Terraform run triggers between workspaces instead handles the requirement to coordinate a dependent app deployment following an upstream network workspace apply, so this behavior does not describe HCP Terraform run triggers between workspaces in the situation named.
C:The description applies to HCP Terraform organization separation when an engineer needs to separate independent business units with different governance needs; the named HCP Terraform run triggers between workspaces instead handles the requirement to coordinate a dependent app deployment following an upstream network workspace apply, so this behavior does not describe HCP Terraform run triggers between workspaces in the situation named.
D:The description applies to project-level variable sets when an engineer needs to assign common environment values to a group of workspaces; the named HCP Terraform run triggers between workspaces instead handles the requirement to coordinate a dependent app deployment following an upstream network workspace apply, so this behavior does not describe HCP Terraform run triggers between workspaces in the situation named.
Question 1040
During an infrastructure design review about how to inspect the addresses of instances currently tracked in state, a maintainer asks what “terraform state list” does. Which description is accurate?
- The state list command enumerates Terraform resource addresses without creating or deleting infrastructure.
- State can retain dependency information needed to correctly destroy objects no longer declared in configuration.
- A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes.
- Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure.
- State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to inspect the addresses of instances currently tracked in state, so it produces the behavior described. In contrast, remote state sharing boundaries serves a different goal: avoid exposing full state when another stack only needs a published identifier, not inspect the addresses of instances currently tracked in state.
Incorrect Answers
B:The description applies to state-backed dependency links when an engineer needs to maintain dependencies for resources that have been removed from configuration; the named terraform state list instead handles the requirement to inspect the addresses of instances currently tracked in state, so this behavior does not describe terraform state list in the situation named.
C:The description applies to state locking when an engineer needs to prevent concurrent state writers from overwriting each other's updates; the named terraform state list instead handles the requirement to inspect the addresses of instances currently tracked in state, so this behavior does not describe terraform state list in the situation named.
D: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 terraform state list instead handles the requirement to inspect the addresses of instances currently tracked in state, so this behavior does not describe terraform state list 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 terraform state list instead handles the requirement to inspect the addresses of instances currently tracked in state, so this behavior does not describe terraform state list in the situation named.