Question 290
A team compares Terraform mechanisms for the goal to connect a root configuration to an HCP Terraform organization and workspace. Which stated consequence belongs specifically to “A cloud block in terraform settings”?
- The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate.
- Terraform does not allow simultaneous cloud and backend blocks because both would compete to control the state and execution connection.
- A terraform cloud block declares organization and workspace selection, integrating the local CLI with HCP Terraform workflows.
- Dynamic credentials integrate HCP Terraform with supported identity federation to obtain scoped run credentials.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to connect a root configuration to an HCP Terraform organization and workspace, so it produces the behavior described. In contrast, mutual exclusivity of cloud and backend serves a different goal: avoid declaring both HCP cloud integration and a standard backend in the same root module, not connect a root configuration to an HCP Terraform organization and workspace.
Incorrect Answers
A: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 a cloud block in terraform settings instead handles the requirement to connect a root configuration to an HCP Terraform organization and workspace, so this behavior does not describe A cloud block in terraform settings in the situation named.
B:The description applies to mutual exclusivity of cloud and backend when an engineer needs to avoid declaring both HCP cloud integration and a standard backend in the same root module; the named a cloud block in terraform settings instead handles the requirement to connect a root configuration to an HCP Terraform organization and workspace, so this behavior does not describe A cloud block in terraform settings in the situation named.
D:The description applies to dynamic provider credential integration when an engineer needs to grant HCP runs temporary cloud authorization instead of long-lived static secrets; the named a cloud block in terraform settings instead handles the requirement to connect a root configuration to an HCP Terraform organization and workspace, so this behavior does not describe A cloud block in terraform settings in the situation named.
Question 291
A Terraform deployment has independent requirements: (1) evaluate organizational infrastructure rules during HCP Terraform runs; (2) authorize a Terraform CLI workflow to access an HCP Terraform organization. Which TWO mechanisms directly address these needs? Choose TWO.
- The HCP private module registry
- HCP Terraform run tasks integration
- Sentinel policy enforcement
- Organization variable sets
- An API token for CLI connectivity
Explanation
Correct Answers
C:Sentinel policies can assess planned infrastructure and produce policy check outcomes before a run can apply when enforcement requires it; this meets the requirement to evaluate organizational infrastructure rules during HCP Terraform runs, while the other selected techniques address authorize a Terraform CLI workflow to access an HCP Terraform organization, which require their own distinct Terraform mechanisms.
E:The HCP service token controls platform API authentication and is distinct from provider credentials used to modify cloud infrastructure; this meets the requirement to authorize a Terraform CLI workflow to access an HCP Terraform organization, while the other selected techniques address evaluate organizational infrastructure rules during HCP Terraform runs, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:Private registry modules can be published, versioned and discovered by authorized HCP Terraform users; it addresses share approved modules with organization members without relying on public registry visibility, but this delivery instead requires evaluate organizational infrastructure rules during HCP Terraform runs and authorize a Terraform CLI workflow to access an HCP Terraform organization. The required combination involves Sentinel policy enforcement and An API token for CLI connectivity, not the behavior of The HCP private module registry.
B:Run tasks integrate external systems into workflow checkpoints without changing the Terraform resource graph directly; it addresses send proposed changes to a third-party quality or security check service, but this delivery instead requires evaluate organizational infrastructure rules during HCP Terraform runs and authorize a Terraform CLI workflow to access an HCP Terraform organization. The required combination involves Sentinel policy enforcement and An API token for CLI connectivity, not the behavior of HCP Terraform run tasks integration.
D:Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects; it addresses supply shared environment or Terraform input values across several workspaces, but this delivery instead requires evaluate organizational infrastructure rules during HCP Terraform runs and authorize a Terraform CLI workflow to access an HCP Terraform organization. The required combination involves Sentinel policy enforcement and An API token for CLI connectivity, not the behavior of Organization variable sets.
Question 292
A configuration review for an application stack needs to pass a temporary sensitive value from a child module to its parent. Which feature or operation is the most direct match?
- An ephemeral child module output
- Environment-based provider credentials
- HCP Terraform sensitive workspace variables
- Vault-backed secret retrieval
Explanation
Correct Answer
A:Ephemeral outputs are permitted on child modules, allowing a value to travel through an allowed ephemeral context without entering state; this directly meets the requirement to pass a temporary sensitive value from a child module to its parent. By comparison, environment-based provider credentials is intended to avoid putting provider access tokens directly in configuration source, which is a different task from pass a temporary sensitive value from a child module to its parent.
Incorrect Answers
B:Providers can often authenticate through environment variables or identity integrations so credentials are absent from checked-in HCL; this mechanism is useful when the job is to avoid putting provider access tokens directly in configuration source, whereas the current scenario requires the engineer to pass a temporary sensitive value from a child module to its parent. These operations have different effects in the stated Terraform workflow.
C:HCP Terraform can mark workspace variables sensitive to limit UI exposure, though sensitive flags do not replace secure state access; this mechanism is useful when the job is to avoid exposing a secret in ordinary workspace variable screens and logs, whereas the current scenario requires the engineer to pass a temporary sensitive value from a child module to its parent. These operations have different effects in the stated Terraform workflow.
D:Vault can centralize secret lifecycle, policies and auditability, but provider and state-handling choices still determine whether a retrieved value is persisted; this mechanism is useful when the job is to retrieve an operational credential from a dedicated secret manager rather than committing it, whereas the current scenario requires the engineer to pass a temporary sensitive value from a child module to its parent. These operations have different effects in the stated Terraform workflow.
Question 293
A change request asks an engineer to provide root-module input values from an automated execution environment. Which choice best implements the requested behavior?
- A child module output block
- A locals block
- An environment variable prefixed TF_VAR_
- terraform output -raw
Explanation
Correct Answer
C:Terraform reads variables named TF_VAR_name as a source of input assignments, subject to input precedence rules; this directly meets the requirement to provide root-module input values from an automated execution environment. By comparison, a locals block is intended to compute and reuse a derived expression without asking callers to supply it, which is a different task from provide root-module input values from an automated execution environment.
Incorrect Answers
A:A child module must explicitly export an output for its parent to access it through module.CHILD.OUTPUT; this mechanism is useful when the job is to make a child module's private resource attribute available to its caller, whereas the current scenario requires the engineer to provide root-module input values from an automated execution environment. These operations have different effects in the stated Terraform workflow.
B:Local values are internal named expressions accessed using local.NAME; they are not module input parameters; this mechanism is useful when the job is to compute and reuse a derived expression without asking callers to supply it, whereas the current scenario requires the engineer to provide root-module input values from an automated execution environment. These operations have different effects in the stated Terraform workflow.
D:The -raw output mode prints a single string, number or boolean value in a script-friendly form and may reveal sensitive data; this mechanism is useful when the job is to extract a primitive output without the surrounding formatted representation, whereas the current scenario requires the engineer to provide root-module input values from an automated execution environment. These operations have different effects in the stated Terraform workflow.
Question 294
A Terraform change proposal names “Child input variable scope” to make a setting available inside a called module without creating a global variable. Which outcome can reviewers attribute to that particular mechanism?
- Variables declared by a child module belong to that module and receive values via the caller's module block.
- An object type lets a module enforce named configuration fields instead of accepting many untyped values.
- A child module may validate its input variables using conditions and errors independent of the parent's variable definitions.
- Default provider configurations can be inherited, while alternate aliases need explicit mapping and declared configuration aliases.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to make a setting available inside a called module without creating a global variable, so it produces the behavior described. In contrast, input object variables serves a different goal: pass a structured settings bundle into a reusable module, not make a setting available inside a called module without creating a global variable.
Incorrect Answers
B:The description applies to input object variables when an engineer needs to pass a structured settings bundle into a reusable module; the named child input variable scope instead handles the requirement to make a setting available inside a called module without creating a global variable, so this behavior does not describe Child input variable scope in the situation named.
C:The description applies to variable validation inside a module when an engineer needs to enforce a reusable module's own input contract; the named child input variable scope instead handles the requirement to make a setting available inside a called module without creating a global variable, so this behavior does not describe Child input variable scope in the situation named.
D:The description applies to provider configuration inheritance when an engineer needs to understand which provider settings a child module can use from its parent; the named child input variable scope instead handles the requirement to make a setting available inside a called module without creating a global variable, so this behavior does not describe Child input variable scope in the situation named.
Question 295
A runbook lists “A resource graph” for the task to determine a safe sequence for creating objects with references between them. Which technical effect should its description include?
- Infrastructure configuration can be committed and reviewed in version control so the intended change is traceable before a Terraform run.
- Terraform reads .tf files written in HCL, including blocks, arguments, expressions and references that describe the intended objects.
- Planning compares configuration with state and refreshed remote data to propose actions that reconcile differences.
- Terraform derives dependency edges from references, using the graph to order dependent changes and permit safe parallel operations.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to determine a safe sequence for creating objects with references between them, so it produces the behavior described. In contrast, HCL configuration files serves a different goal: represent managed infrastructure using Terraform's native declarative language, not determine a safe sequence for creating objects with references between them.
Incorrect Answers
A:The description applies to version-controlled infrastructure definition when an engineer needs to review a proposed infrastructure change before team members deploy it; the named a resource graph instead handles the requirement to determine a safe sequence for creating objects with references between them, so this behavior does not describe A resource graph in the situation named.
B:The description applies to HCL configuration files when an engineer needs to represent managed infrastructure using Terraform's native declarative language; the named a resource graph instead handles the requirement to determine a safe sequence for creating objects with references between them, so this behavior does not describe A resource graph in the situation named.
C:The description applies to desired-state reconciliation when an engineer needs to identify changes between the declared configuration and managed infrastructure; the named a resource graph instead handles the requirement to determine a safe sequence for creating objects with references between them, so this behavior does not describe A resource graph in the situation named.
Question 296
A cloud engineering team using managed Terraform runs requires a way to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname. Which Terraform approach most directly fulfills that request?
- A cloud block in terraform settings
- HCP Terraform VCS integration
- Mutual exclusivity of cloud and backend
- A cloud workspaces name setting
- terraform login
Explanation
Correct Answer
E:The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate; this directly meets the requirement to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname. By comparison, HCP Terraform VCS integration is intended to connect reviewed repository commits to automated infrastructure plans, which is a different task from authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname.
Incorrect Answers
A:A terraform cloud block declares organization and workspace selection, integrating the local CLI with HCP Terraform workflows; this mechanism is useful when the job is to connect a root configuration to an HCP Terraform organization and workspace, whereas the current scenario requires the engineer to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname. These operations have different effects in the stated Terraform workflow.
B:A VCS-connected workspace coordinates code changes, speculative plans and controlled applies through supported repository integration; this mechanism is useful when the job is to connect reviewed repository commits to automated infrastructure plans, whereas the current scenario requires the engineer to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname. These operations have different effects in the stated Terraform workflow.
C:Terraform does not allow simultaneous cloud and backend blocks because both would compete to control the state and execution connection; this mechanism is useful when the job is to avoid declaring both HCP cloud integration and a standard backend in the same root module, whereas the current scenario requires the engineer to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname. These operations have different effects in the stated Terraform workflow.
D:The cloud block's workspaces name attribute identifies one workspace, rather than selecting an arbitrary state path; this mechanism is useful when the job is to target a particular HCP Terraform workspace from a root configuration, whereas the current scenario requires the engineer to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname. These operations have different effects in the stated Terraform workflow.
Question 297
During an infrastructure design review about how to model a Terraform-managed lifecycle value without requiring an external service object, a maintainer asks what “The terraform_data resource” does. Which description is accurate?
- Data source reads can be deferred during planning when their inputs depend on values not known until apply.
- References like aws_vpc.main.id use a managed resource's attributes and create an implicit dependency.
- The built-in terraform_data resource can represent input changes and trigger replacement behavior without managing a cloud API resource.
- A resource type name usually starts with its provider local name, such as aws_instance for the AWS provider.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to model a Terraform-managed lifecycle value without requiring an external service object, so it produces the behavior described. In contrast, a resource attribute reference serves a different goal: pass a newly managed object's computed identifier to a dependent resource, not model a Terraform-managed lifecycle value without requiring an external service object.
Incorrect Answers
A:The description applies to a data source that depends on a resource when an engineer needs to delay a lookup until a prerequisite object is available; the named the terraform_data resource instead handles the requirement to model a Terraform-managed lifecycle value without requiring an external service object, so this behavior does not describe The terraform_data resource in the situation named.
B:The description applies to a resource attribute reference when an engineer needs to pass a newly managed object's computed identifier to a dependent resource; the named the terraform_data resource instead handles the requirement to model a Terraform-managed lifecycle value without requiring an external service object, so this behavior does not describe The terraform_data resource in the situation named.
D:The description applies to provider resource type prefixes when an engineer needs to identify which provider implements a resource's API operations; the named the terraform_data resource instead handles the requirement to model a Terraform-managed lifecycle value without requiring an external service object, so this behavior does not describe The terraform_data resource in the situation named.
Question 298
A change request asks an engineer to route a particular managed object to the named alternate provider configuration. Which choice best implements the requested behavior?
- Provider-local name mapping
- A default provider configuration
- A resource's provider meta-argument
- Separate required provider names
Explanation
Correct Answer
C:The resource-level provider meta-argument selects a provider instance, not a different backend or Terraform workspace; this directly meets the requirement to route a particular managed object to the named alternate provider configuration. By comparison, provider-local name mapping is intended to reuse a provider whose source address differs from its short local identifier, which is a different task from route a particular managed object to the named alternate provider configuration.
Incorrect Answers
A:The required_providers entry maps the chosen local name to a specific fully qualified provider source address; this mechanism is useful when the job is to reuse a provider whose source address differs from its short local identifier, whereas the current scenario requires the engineer to route a particular managed object to the named alternate provider configuration. These operations have different effects in the stated Terraform workflow.
B:An unaliased provider block configures the default instance used by matching resources that do not override provider selection; this mechanism is useful when the job is to make resources use a common account without an explicit provider argument, whereas the current scenario requires the engineer to route a particular managed object to the named alternate provider configuration. These operations have different effects in the stated Terraform workflow.
D:List both plugins under required_providers and configure each service's provider independently as needed; this concerns the task to use two unrelated service APIs in one root configuration, not the current need to route a particular managed object to the named alternate provider configuration. A A resource's provider meta-argument approach is appropriate here; the substituted Separate required provider names option does not supply the specified Terraform capability.
Question 299
A change request asks an engineer to report a failed ongoing infrastructure assertion without ordinarily blocking the apply. Which choice best implements the requested behavior?
- Resource postcondition
- Custom conditions with unknown values
- The check block
- The error_message field
Explanation
Correct Answer
C:Check assertions evaluate health expectations and normally report warning diagnostics rather than blocking deployment on a false condition; this directly meets the requirement to report a failed ongoing infrastructure assertion without ordinarily blocking the apply. By comparison, resource postcondition is intended to verify an invariant about a resource after reading or managing it, which is a different task from report a failed ongoing infrastructure assertion without ordinarily blocking the apply.
Incorrect Answers
A:A postcondition evaluates a condition concerning resource results and blocks downstream use when its assertion fails; this mechanism is useful when the job is to verify an invariant about a resource after reading or managing it, whereas the current scenario requires the engineer to report a failed ongoing infrastructure assertion without ordinarily blocking the apply. These operations have different effects in the stated Terraform workflow.
B:Terraform may defer condition evaluation to apply when required expression values are unknown during planning; this mechanism is useful when the job is to understand when a validation cannot yet be decided at planning time, whereas the current scenario requires the engineer to report a failed ongoing infrastructure assertion without ordinarily blocking the apply. These operations have different effects in the stated Terraform workflow.
D:Validation, precondition and postcondition definitions use error_message to tell the operator why a rule failed; this mechanism is useful when the job is to present a meaningful explanation when a custom condition evaluates false, whereas the current scenario requires the engineer to report a failed ongoing infrastructure assertion without ordinarily blocking the apply. These operations have different effects in the stated Terraform workflow.
Question 300
In a Terraform configuration, what value does the HCL expression sum([2, 3, 5]) evaluate to?
- 3
- 5
- 10
- 30
Explanation
Correct Answer
C:The expression sum([2, 3, 5]) evaluates to 10 because sum adds the three numeric list members to obtain ten. This is Terraform's direct evaluation of the supplied literal arguments in sum([2, 3, 5]), not an external provider lookup.
Incorrect Answers
A:Sum does not return the count of list entries. In this specific evaluation, sum adds the three numeric list members to obtain ten, which rules out the proposed alternative.
B:The final list element is not the entire aggregate. For sum([2, 3, 5]), sum adds the three numeric list members to obtain ten; consequently this candidate is not the value Terraform computes.
D:Multiplying the inputs is not the operation performed by sum. HCL evaluates sum([2, 3, 5]) using the supplied arguments: sum adds the three numeric list members to obtain ten; the listed result is therefore incorrect.