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.
Question 971
An engineer intends to retrieve computed identifiers that can be used by deployment automation and is reviewing “Post-apply outputs”. What consequence follows from using it as intended?
- The auto-approve option allows the automatically created plan to proceed without interactive confirmation, so pipeline safeguards matter.
- The -var option supplies a named input for the execution; it does not edit the variable declaration in code.
- The parallelism setting controls Terraform's concurrent resource operation count, which can mitigate API throttling.
- Root output blocks expose values Terraform calculates from the applied resource graph; output display is not an access-control boundary.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to retrieve computed identifiers that can be used by deployment automation, 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 retrieve computed identifiers that can be used by deployment automation.
Incorrect Answers
A: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 post-apply outputs instead handles the requirement to retrieve computed identifiers that can be used by deployment automation, so this behavior does not describe Post-apply outputs in the situation named.
B:The description applies to apply with -var when an engineer needs to override a declared root-module input value for a particular run; the named post-apply outputs instead handles the requirement to retrieve computed identifiers that can be used by deployment automation, so this behavior does not describe Post-apply outputs in the situation named.
C:The description applies to terraform apply -parallelism when an engineer needs to limit how many graph operations execute concurrently; the named post-apply outputs instead handles the requirement to retrieve computed identifiers that can be used by deployment automation, so this behavior does not describe Post-apply outputs in the situation named.
Question 972
A runbook lists “each.value” for the task to read the per-instance map value when iterating with for_each. Which technical effect should its description include?
- For a map-based for_each collection, each.value exposes the value associated with the current each.key.
- The depends_on meta-argument adds dependency edges for a known relationship that Terraform cannot otherwise infer.
- Count instances have numeric indexes such as aws_instance.web[1] for the second instance.
- Instances made from a map or string set have addresses such as aws_instance.web["blue"], rather than an integer count index.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to read the per-instance map value when iterating with for_each, so it produces the behavior described. In contrast, an instance address with count serves a different goal: refer specifically to the second object of a count-created resource, not read the per-instance map value when iterating with for_each.
Incorrect Answers
B:The description applies to explicit depends_on when an engineer needs to order resources when there is a dependency not expressed by attribute references; the named each.value instead handles the requirement to read the per-instance map value when iterating with for_each, so this behavior does not describe each.value in the situation named.
C:The description applies to an instance address with count when an engineer needs to refer specifically to the second object of a count-created resource; the named each.value instead handles the requirement to read the per-instance map value when iterating with for_each, so this behavior does not describe each.value in the situation named.
D:The description applies to a for_each instance address when an engineer needs to identify a single managed object selected by a string key; the named each.value instead handles the requirement to read the per-instance map value when iterating with for_each, so this behavior does not describe each.value in the situation named.
Question 973
A team proposes “Partial backend configuration” to store Terraform state as an object in an S3 bucket. If they proceed with that technique, which result should they anticipate instead?
- Backend config arguments supplied at init time fill required values, but sensitive content can still be cached in local metadata or plans.
- Cloud storage policy and backend authorization decide who can obtain or mutate stored Terraform state; provider credentials alone are not sufficient.
- The S3 backend uses configured bucket and key settings, plus suitable authentication and optional locking support.
- Encryption is controlled by the chosen backend service; Terraform's remote backend abstraction does not supply one universal encryption mechanism.
Explanation
Correct Answer
A:Partial backend configuration is used when an operator needs to provide environment-specific backend details at initialization rather than hard-coding them. Consequently, this choice cannot meet the separate requirement to store Terraform state as an object in an S3 bucket. The intended action would instead require The S3 backend.
Incorrect Answers
B:This behavior belongs to Remote backend access permissions, which helps engineers enforce read and write privileges on the state object rather than satisfying the separate requirement to store Terraform state as an object in an S3 bucket. The attempted technique was Partial backend configuration; it would instead be used to provide environment-specific backend details at initialization rather than hard-coding them, not to produce the effect associated with Remote backend access permissions.
C:That outcome belongs to The S3 backend, the mechanism that can store Terraform state as an object in an S3 bucket. The question concerns the engineer’s actual proposal, Partial backend configuration; it is directed at provide environment-specific backend details at initialization rather than hard-coding them, not that result.
D:This behavior belongs to Remote state encryption at rest, which helps engineers protect stored state contents from unauthorized storage-layer access rather than satisfying the separate requirement to store Terraform state as an object in an S3 bucket. The attempted technique was Partial backend configuration; it would instead be used to provide environment-specific backend details at initialization rather than hard-coding them, not to produce the effect associated with Remote state encryption at rest.
Question 974
A pipeline responsible for the Terraform workflow requires a way to preview resource actions implied by the current configuration and state. Which Terraform approach most directly fulfills that request?
- An unknown value until apply
- A resource action marked plus
- The dependency graph during planning
- terraform plan
Explanation
Correct Answer
D:Planning calculates an execution proposal after reading configuration and usually refreshing managed resource data; this directly meets the requirement to preview resource actions implied by the current configuration and state. By comparison, a resource action marked plus is intended to interpret the leading + symbol in Terraform's plan, which is a different task from preview resource actions implied by the current configuration and state.
Incorrect Answers
A:Terraform may mark attributes as known after apply because a provider assigns their values only when creating or updating a real object; this mechanism is useful when the job is to understand why a computed attribute is unavailable in the preview, whereas the current scenario requires the engineer to preview resource actions implied by the current configuration and state. These operations have different effects in the stated Terraform workflow.
B:In conventional human-readable plans, + signifies that a managed resource is proposed for creation; this mechanism is useful when the job is to interpret the leading + symbol in Terraform's plan, whereas the current scenario requires the engineer to preview resource actions implied by the current configuration and state. These operations have different effects in the stated Terraform workflow.
C:Terraform graph nodes can run concurrently when no dependency edge requires a particular order; this mechanism is useful when the job is to explain why two unrelated resources can be planned and applied in parallel, whereas the current scenario requires the engineer to preview resource actions implied by the current configuration and state. These operations have different effects in the stated Terraform workflow.
Question 975
During a design review, the requirement is to standardize a reusable network pattern across multiple applications. Which option should the engineer select?
- Consistent dependency management
- Reusing modules
- Idempotent convergence
- Collaboration through remote state
Explanation
Correct Answer
B:A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design; this directly meets the requirement to standardize a reusable network pattern across multiple applications. By comparison, consistent dependency management is intended to avoid hand-sequencing every resource operation, which is a different task from standardize a reusable network pattern across multiple applications.
Incorrect Answers
A:Terraform infers many dependencies from references and applies graph ordering to create or modify related resources safely; this mechanism is useful when the job is to avoid hand-sequencing every resource operation, whereas the current scenario requires the engineer to standardize a reusable network pattern across multiple applications. These operations have different effects in the stated Terraform workflow.
C:With no configuration or remote drift requiring action, a new plan normally proposes no infrastructure changes; this mechanism is useful when the job is to run unchanged configuration repeatedly without inventing new infrastructure updates, whereas the current scenario requires the engineer to standardize a reusable network pattern across multiple applications. These operations have different effects in the stated Terraform workflow.
D:A backend supporting remote storage and locking can centralize state and prevent conflicting concurrent changes; this mechanism is useful when the job is to allow authorized operators to use one shared source of Terraform state, whereas the current scenario requires the engineer to standardize a reusable network pattern across multiple applications. These operations have different effects in the stated Terraform workflow.
Question 976
A Terraform reviewer encounters “Collaboration through remote state” while assessing how to allow authorized operators to use one shared source of Terraform state. Which statement correctly describes its actual behavior?
- A backend supporting remote storage and locking can centralize state and prevent conflicting concurrent changes.
- A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design.
- Terraform input variables permit different values for capacity, names and endpoints without copying the entire resource definition.
- A version-control pull request can expose infrastructure edits to peer review, policy checks and automated validation.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to allow authorized operators to use one shared source of Terraform state, so it produces the behavior described. In contrast, environment parametrization serves a different goal: deploy similarly structured stacks with environment-specific settings, not allow authorized operators to use one shared source of Terraform state.
Incorrect Answers
B:The description applies to reusing modules when an engineer needs to standardize a reusable network pattern across multiple applications; the named collaboration through remote state instead handles the requirement to allow authorized operators to use one shared source of Terraform state, so this behavior does not describe Collaboration through remote state in the situation named.
C:The description applies to environment parametrization when an engineer needs to deploy similarly structured stacks with environment-specific settings; the named collaboration through remote state instead handles the requirement to allow authorized operators to use one shared source of Terraform state, so this behavior does not describe Collaboration through remote state in the situation named.
D:The description applies to code review of infrastructure when an engineer needs to catch undesirable configuration changes before deployment; the named collaboration through remote state instead handles the requirement to allow authorized operators to use one shared source of Terraform state, so this behavior does not describe Collaboration through remote state in the situation named.
Question 977
The team evaluates “A bool variable type” for a requirement to limit a feature toggle to true or false values. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- The bool primitive type represents logical truth values used in conditionals and comparisons.
- tolist converts compatible values to a list, but a source set's original order is not inherently meaningful.
- Keyed for_each instances use stable identifiers, whereas count indexes can shift when list elements are deleted.
- The count meta-argument uses an integer expression and creates zero-based numeric instance addresses.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to limit a feature toggle to true or false values, so it produces the behavior described. In contrast, avoiding index churn with for_each serves a different goal: preserve instance identity when a middle collection item is removed, not limit a feature toggle to true or false values.
Incorrect Answers
B:The description applies to tolist conversion when an engineer needs to coerce a suitable collection into a list for ordered operations; the named a bool variable type instead handles the requirement to limit a feature toggle to true or false values, so this behavior does not describe A bool variable type in the situation named.
C:The description applies to avoiding index churn with for_each when an engineer needs to preserve instance identity when a middle collection item is removed; the named a bool variable type instead handles the requirement to limit a feature toggle to true or false values, so this behavior does not describe A bool variable type in the situation named.
D:The description applies to count with a number when an engineer needs to create a specified number of similarly configured resource instances; the named a bool variable type instead handles the requirement to limit a feature toggle to true or false values, so this behavior does not describe A bool variable type in the situation named.
Question 978
An engineer proposes “A resource graph” to represent managed infrastructure using Terraform's native declarative language. Which outcome does the proposed technique actually provide?
- Terraform derives dependency edges from references, using the graph to order dependent changes and permit safe parallel operations.
- Terraform reads .tf files written in HCL, including blocks, arguments, expressions and references that describe the intended objects.
- Terraform interprets resource declarations, constructs a dependency graph, and asks providers to reconcile real objects with that desired state.
- Infrastructure configuration can be committed and reviewed in version control so the intended change is traceable before a Terraform run.
Explanation
Correct Answer
A:A resource graph is used when an operator needs to determine a safe sequence for creating objects with references between them. Consequently, this choice cannot meet the separate requirement to represent managed infrastructure using Terraform's native declarative language. The intended action would instead require HCL configuration files.
Incorrect Answers
B:That outcome belongs to HCL configuration files, the mechanism that can represent managed infrastructure using Terraform's native declarative language. The question concerns the engineer’s actual proposal, A resource graph; it is directed at determine a safe sequence for creating objects with references between them, not that result.
C:This behavior belongs to Declarative resource configuration, which helps engineers describe the desired infrastructure state instead of scripting every API step rather than satisfying the separate requirement to represent managed infrastructure using Terraform's native declarative language. The attempted technique was A resource graph; it would instead be used to determine a safe sequence for creating objects with references between them, not to produce the effect associated with Declarative resource configuration.
D:This behavior belongs to Version-controlled infrastructure definition, which helps engineers review a proposed infrastructure change before team members deploy it rather than satisfying the separate requirement to represent managed infrastructure using Terraform's native declarative language. The attempted technique was A resource graph; it would instead be used to determine a safe sequence for creating objects with references between them, not to produce the effect associated with Version-controlled infrastructure definition.
Question 979
An engineer preparing an infrastructure rollout needs to override a declared root-module input value for a particular run. Which feature or operation is the most direct match?
- Apply with -var
- Apply failure recovery
- terraform apply -auto-approve
- Refresh during apply planning
Explanation
Correct Answer
A:The -var option supplies a named input for the execution; it does not edit the variable declaration in code; this directly meets the requirement to override a declared root-module input value for a particular run. By comparison, apply failure recovery is intended to inspect state and re-plan when a provider operation fails partway through, which is a different task from override a declared root-module input value for a particular run.
Incorrect Answers
B:A partial apply may have changed some resources, so Terraform should refresh and build a new plan rather than blindly assuming a full rollback; this mechanism is useful when the job is to inspect state and re-plan when a provider operation fails partway through, whereas the current scenario requires the engineer to override a declared root-module input value for a particular run. These operations have different effects in the stated Terraform workflow.
C:The auto-approve option allows the automatically created plan to proceed without interactive confirmation, so pipeline safeguards matter; this mechanism is useful when the job is to suppress Terraform's normal approval prompt in a controlled pipeline, whereas the current scenario requires the engineer to override a declared root-module input value for a particular run. These operations have different effects in the stated Terraform workflow.
D:For a normal fresh apply, Terraform plans with current provider observations unless refresh is explicitly disabled; saved plan behavior differs; this mechanism is useful when the job is to avoid applying from stale remembered attributes after remote drift, whereas the current scenario requires the engineer to override a declared root-module input value for a particular run. These operations have different effects in the stated Terraform workflow.
Question 980
A runbook lists “An HCP private registry module source” for the task to consume a module managed by the organization's HCP private registry. Which technical effect should its description include?
- Run tasks integrate external systems into workflow checkpoints without changing the Terraform resource graph directly.
- A module source can reference a private registry hostname and namespace after the client has appropriate authentication.
- The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate.
- Running init processes the cloud block and configures workspace connectivity before plans or applies.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to consume a module managed by the organization's HCP private registry, so it produces the behavior described. In contrast, terraform login serves a different goal: authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname, not consume a module managed by the organization's HCP private registry.
Incorrect Answers
A:The description applies to HCP Terraform run tasks integration when an engineer needs to send proposed changes to a third-party quality or security check service; the named an HCP private registry module source instead handles the requirement to consume a module managed by the organization's HCP private registry, so this behavior does not describe An HCP private registry module source in the situation named.
C:The description applies to terraform login when an engineer needs to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname; the named an HCP private registry module source instead handles the requirement to consume a module managed by the organization's HCP private registry, so this behavior does not describe An HCP private registry module source in the situation named.
D:The description applies to terraform init after adding cloud integration when an engineer needs to configure the local working directory to connect with the selected HCP workspace; the named an HCP private registry module source instead handles the requirement to consume a module managed by the organization's HCP private registry, so this behavior does not describe An HCP private registry module source in the situation named.