Question 690
A reusable module interface review needs to keep authentication and deployment-specific region choices outside a reusable child module. Which feature or operation is the most direct match?
- Avoiding hard-coded child credentials
- Module-level depends_on
- A module dependency interface
- Using a module registry version
- A module with for_each
- A module with count
Explanation
Correct Answer
A:Reusable modules normally declare provider requirements while callers supply provider configurations and credentials; this directly meets the requirement to keep authentication and deployment-specific region choices outside a reusable child module. By comparison, a module with count is intended to instantiate a fixed number of child module copies, which is a different task from keep authentication and deployment-specific region choices outside a reusable child module.
Incorrect Answers
B:depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency; this mechanism is useful when the job is to create an explicit ordering edge for module resources that have a real hidden dependency, whereas the current scenario requires the engineer to keep authentication and deployment-specific region choices outside a reusable child module. These operations have different effects in the stated Terraform workflow.
C:An output-to-input reference establishes a natural dependency and avoids imposing broad depends_on edges unnecessarily; this mechanism is useful when the job is to connect two modules by declared output and input values, whereas the current scenario requires the engineer to keep authentication and deployment-specific region choices outside a reusable child module. These operations have different effects in the stated Terraform workflow.
D:The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings; this mechanism is useful when the job is to control which published module release a root configuration consumes, whereas the current scenario requires the engineer to keep authentication and deployment-specific region choices outside a reusable child module. These operations have different effects in the stated Terraform workflow.
E:The for_each meta-argument instantiates keyed module instances addressable as module.NAME["key"]; this mechanism is useful when the job is to create one child module instance for each stable application key, whereas the current scenario requires the engineer to keep authentication and deployment-specific region choices outside a reusable child module. These operations have different effects in the stated Terraform workflow.
F:The count meta-argument creates numerically indexed module instances such as module.worker[0]; this mechanism is useful when the job is to instantiate a fixed number of child module copies, whereas the current scenario requires the engineer to keep authentication and deployment-specific region choices outside a reusable child module. These operations have different effects in the stated Terraform workflow.
Question 691
The team evaluates “Organization variable sets” for a requirement to supply shared environment or Terraform input values across several workspaces. Which observed behavior belongs to that mechanism rather than a different Terraform feature?
- Variable sets let administrators manage common workspace variables centrally and scope them to intended workspaces or projects.
- Registry access and publishing permissions help centralize reusable module governance across teams.
- HCP Terraform can estimate resource costs for supported providers and resources before apply; estimates are not invoices.
- Run tasks send run context to integrated systems and can participate in checks or approval workflows, depending on configuration.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to supply shared environment or Terraform input values across several workspaces, so it produces the behavior described. In contrast, cost estimation serves a different goal: preview an estimated cost impact of planned infrastructure changes when available, not supply shared environment or Terraform input values across several workspaces.
Incorrect Answers
B:The description applies to a restricted private registry when an engineer needs to let approved teams discover modules while controlling publication rights; the named organization variable sets instead handles the requirement to supply shared environment or Terraform input values across several workspaces, so this behavior does not describe Organization variable sets in the situation named.
C:The description applies to cost estimation when an engineer needs to preview an estimated cost impact of planned infrastructure changes when available; the named organization variable sets instead handles the requirement to supply shared environment or Terraform input values across several workspaces, so this behavior does not describe Organization variable sets in the situation named.
D:The description applies to HCP Terraform run tasks when an engineer needs to integrate external checks into a run before applying infrastructure changes; the named organization variable sets instead handles the requirement to supply shared environment or Terraform input values across several workspaces, so this behavior does not describe Organization variable sets in the situation named.
Question 692
A team sharing an infrastructure state has a concrete implementation goal: protect stored state contents from unauthorized storage-layer access. What is the most appropriate Terraform mechanism?
- The S3 backend
- Remote state encryption at rest
- A terraform backend block
- No input variable interpolation in a backend block
Explanation
Correct Answer
B:Encryption is controlled by the chosen backend service; Terraform's remote backend abstraction does not supply one universal encryption mechanism; this directly meets the requirement to protect stored state contents from unauthorized storage-layer access. By comparison, no input variable interpolation in a backend block is intended to avoid expecting var.region or local.name to populate backend settings, which is a different task from protect stored state contents from unauthorized storage-layer access.
Incorrect Answers
A:The S3 backend uses configured bucket and key settings, plus suitable authentication and optional locking support; this mechanism is useful when the job is to store Terraform state as an object in an S3 bucket, whereas the current scenario requires the engineer to protect stored state contents from unauthorized storage-layer access. These operations have different effects in the stated Terraform workflow.
C:A terraform { backend "TYPE" {} } declaration selects state storage; its settings are initialized separately from provider configuration; this mechanism is useful when the job is to declare the backend type and settings used to store root-module state, whereas the current scenario requires the engineer to protect stored state contents from unauthorized storage-layer access. These operations have different effects in the stated Terraform workflow.
D:Backend configuration is processed at initialization, before ordinary input expressions are evaluated, so it cannot use regular variables or locals; this mechanism is useful when the job is to avoid expecting var.region or local.name to populate backend settings, whereas the current scenario requires the engineer to protect stored state contents from unauthorized storage-layer access. These operations have different effects in the stated Terraform workflow.
Question 693
A Terraform change proposal names “A variable default value” to make a module input optional for callers using a common baseline. Which outcome can reviewers attribute to that particular mechanism?
- The -var-file flag explicitly selects a variables file rather than relying on auto-loaded naming conventions.
- The JSON output mode serializes output values and metadata for automation; it can expose sensitive values and must be protected.
- The default argument supplies a value when the caller provides no other assignment for that variable.
- Marking an output sensitive redacts ordinary CLI presentation, but does not by itself prevent storage in state.
Explanation
Correct Answer
C:The named mechanism is used when the objective is to make a module input optional for callers using a common baseline, so it produces the behavior described. In contrast, terraform output -json serves a different goal: retrieve root outputs for integration with another program, not make a module input optional for callers using a common baseline.
Incorrect Answers
A:The description applies to the -var-file option when an engineer needs to load a nonstandard variable file selected for one environment; the named a variable default value instead handles the requirement to make a module input optional for callers using a common baseline, so this behavior does not describe A variable default value in the situation named.
B:The description applies to terraform output -json when an engineer needs to retrieve root outputs for integration with another program; the named a variable default value instead handles the requirement to make a module input optional for callers using a common baseline, so this behavior does not describe A variable default value in the situation named.
D:The description applies to a sensitive output when an engineer needs to hide a secret-like output from Terraform's usual human-readable display; the named a variable default value instead handles the requirement to make a module input optional for callers using a common baseline, so this behavior does not describe A variable default value in the situation named.
Question 694
A team consuming shared Terraform modules has a concrete implementation goal: set a reusable module's environment tag from the caller. What is the most appropriate Terraform mechanism?
- A child module output
- Root input variable scope
- A local value confined to its module
- Parent-to-child argument passing
Explanation
Correct Answer
D:A module block explicitly sets the child's declared input variables using arguments of matching names; this directly meets the requirement to set a reusable module's environment tag from the caller. By comparison, root input variable scope is intended to read command-line and tfvars input values for the root module, which is a different task from set a reusable module's environment tag from the caller.
Incorrect Answers
A:The output block defines a published module interface; the parent reads the value as module.NAME.OUTPUT; this mechanism is useful when the job is to expose a chosen internal attribute to the calling parent module, whereas the current scenario requires the engineer to set a reusable module's environment tag from the caller. These operations have different effects in the stated Terraform workflow.
B:Root variables accept runtime assignments, whereas a child module normally receives its inputs through the parent's module call; this mechanism is useful when the job is to read command-line and tfvars input values for the root module, whereas the current scenario requires the engineer to set a reusable module's environment tag from the caller. These operations have different effects in the stated Terraform workflow.
C:Locals live within the module where defined and cannot be referenced from another module without passing or exposing a value; this mechanism is useful when the job is to avoid assuming a local calculation is automatically visible in a parent module, whereas the current scenario requires the engineer to set a reusable module's environment tag from the caller. These operations have different effects in the stated Terraform workflow.
Question 695
An application stack composed of modules has a concrete implementation goal: understand which provider settings a child module can use from its parent. What is the most appropriate Terraform mechanism?
- A variable default inside a child
- Child module outputs and sensitivity
- Provider configuration inheritance
- Root input variable scope
Explanation
Correct Answer
C:Default provider configurations can be inherited, while alternate aliases need explicit mapping and declared configuration aliases; this directly meets the requirement to understand which provider settings a child module can use from its parent. By comparison, a variable default inside a child is intended to make a module input optional when callers do not require customization, which is a different task from understand which provider settings a child module can use from its parent.
Incorrect Answers
A:A default inside the child variable declaration applies when the caller omits that module argument; this mechanism is useful when the job is to make a module input optional when callers do not require customization, whereas the current scenario requires the engineer to understand which provider settings a child module can use from its parent. These operations have different effects in the stated Terraform workflow.
B:A child output can be marked sensitive, but its underlying value may still reside in state unless it uses permitted ephemeral handling; this mechanism is useful when the job is to limit ordinary display of a sensitive result exported from a reusable module, whereas the current scenario requires the engineer to understand which provider settings a child module can use from its parent. These operations have different effects in the stated Terraform workflow.
D:Root variables accept runtime assignments, whereas a child module normally receives its inputs through the parent's module call; this mechanism is useful when the job is to read command-line and tfvars input values for the root module, whereas the current scenario requires the engineer to understand which provider settings a child module can use from its parent. These operations have different effects in the stated Terraform workflow.
Question 696
During one infrastructure delivery, the team must satisfy all of the following: (1) define a specific boolean statement for a nonblocking Terraform health check; (2) turn a compatible collection into a uniform-keyed map. Select TWO appropriate Terraform approaches. Choose TWO.
- tomap conversion
- count with a number
- An assert block inside check
- Preconditions for external assumptions
- The null value
Explanation
Correct Answers
A:tomap attempts to convert an input value into a map whose values share a compatible element type; this meets the requirement to turn a compatible collection into a uniform-keyed map, while the other selected techniques address define a specific boolean statement for a nonblocking Terraform health check, which require their own distinct Terraform mechanisms.
C:Check blocks contain assert blocks with condition and error_message to describe an unsuccessful assertion; this meets the requirement to define a specific boolean statement for a nonblocking Terraform health check, while the other selected techniques address turn a compatible collection into a uniform-keyed map, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:The count meta-argument uses an integer expression and creates zero-based numeric instance addresses; it addresses create a specified number of similarly configured resource instances, but this delivery instead requires define a specific boolean statement for a nonblocking Terraform health check and turn a compatible collection into a uniform-keyed map. The required combination involves tomap conversion and An assert block inside check, not the behavior of count with a number.
D:A precondition can express a domain requirement such as a selected image having an expected property before using it; it addresses guard a resource against prerequisites outside the provider's basic schema, but this delivery instead requires define a specific boolean statement for a nonblocking Terraform health check and turn a compatible collection into a uniform-keyed map. The required combination involves tomap conversion and An assert block inside check, not the behavior of Preconditions for external assumptions.
E:In supported contexts, setting an optional resource argument to null behaves like leaving that argument unset; it addresses represent the absence of an optional argument value, but this delivery instead requires define a specific boolean statement for a nonblocking Terraform health check and turn a compatible collection into a uniform-keyed map. The required combination involves tomap conversion and An assert block inside check, not the behavior of The null value.
Question 697
An engineer intends to control which published module release a root configuration consumes and is reviewing “Using a module registry version”. What consequence follows from using it as intended?
- Reusable modules normally declare provider requirements while callers supply provider configurations and credentials.
- depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency.
- The providers map on the module call maps child provider names to selected provider configurations from the root module.
- The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to control which published module release a root configuration consumes, so it produces the behavior described. In contrast, avoiding hard-coded child credentials serves a different goal: keep authentication and deployment-specific region choices outside a reusable child module, not control which published module release a root configuration consumes.
Incorrect Answers
A:The description applies to avoiding hard-coded child credentials when an engineer needs to keep authentication and deployment-specific region choices outside a reusable child module; the named using a module registry version instead handles the requirement to control which published module release a root configuration consumes, so this behavior does not describe Using a module registry version in the situation named.
B:The description applies to module-level depends_on when an engineer needs to create an explicit ordering edge for module resources that have a real hidden dependency; the named using a module registry version instead handles the requirement to control which published module release a root configuration consumes, so this behavior does not describe Using a module registry version in the situation named.
C:The description applies to module provider mappings when an engineer needs to send the correct region-specific provider into a reusable child module; the named using a module registry version instead handles the requirement to control which published module release a root configuration consumes, so this behavior does not describe Using a module registry version in the situation named.
Question 698
An organization integrating Terraform with source control requires a way to move an established root configuration from local state into a managed HCP workspace. Which Terraform approach most directly fulfills that request?
- terraform login
- Dynamic provider credential integration
- Migrating state to HCP Terraform
- A cloud workspaces tags setting
Explanation
Correct Answer
C:Migration requires setting HCP Terraform integration and handling state transfer rather than starting a blank workspace against existing objects; this directly meets the requirement to move an established root configuration from local state into a managed HCP workspace. By comparison, a cloud workspaces tags setting is intended to select an HCP Terraform workspace collection by workspace tags, which is a different task from move an established root configuration from local state into a managed HCP workspace.
Incorrect Answers
A:The login command stores a CLI API token for the selected service host so CLI-driven workflows can authenticate; this mechanism is useful when the job is to authenticate the local Terraform CLI to an HCP Terraform or Terraform Enterprise hostname, whereas the current scenario requires the engineer to move an established root configuration from local state into a managed HCP workspace. These operations have different effects in the stated Terraform workflow.
B:Dynamic credentials integrate HCP Terraform with supported identity federation to obtain scoped run credentials; this mechanism is useful when the job is to grant HCP runs temporary cloud authorization instead of long-lived static secrets, whereas the current scenario requires the engineer to move an established root configuration from local state into a managed HCP workspace. These operations have different effects in the stated Terraform workflow.
D:The cloud integration can choose workspaces based on tags, subject to the workspaces block's allowed configuration form; this mechanism is useful when the job is to select an HCP Terraform workspace collection by workspace tags, whereas the current scenario requires the engineer to move an established root configuration from local state into a managed HCP workspace. These operations have different effects in the stated Terraform workflow.
Question 699
A change request asks an engineer to render a file containing template expressions with an object of variables. Which choice best implements the requested behavior?
- The for expression
- The concat function
- The flatten function
- The substr function
- The templatefile function
- The compact function
Explanation
Correct Answer
E:templatefile reads a template and evaluates placeholders using the supplied variable map; this directly meets the requirement to render a file containing template expressions with an object of variables. By comparison, the compact function is intended to remove empty string elements from a list, which is a different task from render a file containing template expressions with an object of variables.
Incorrect Answers
A:A for expression builds derived collection values, optionally filtering with an if clause and transforming keys or values; this mechanism is useful when the job is to transform a collection's elements into a new list or map, whereas the current scenario requires the engineer to render a file containing template expressions with an object of variables. These operations have different effects in the stated Terraform workflow.
B:concat joins lists end to end and preserves their element ordering, including duplicate values; this mechanism is useful when the job is to append the elements of multiple lists into one sequence, whereas the current scenario requires the engineer to render a file containing template expressions with an object of variables. These operations have different effects in the stated Terraform workflow.
C:flatten recursively replaces nested lists with their constituent elements, while preserving ordered traversal; this mechanism is useful when the job is to remove nested list layers to obtain a flat sequence, whereas the current scenario requires the engineer to render a file containing template expressions with an object of variables. These operations have different effects in the stated Terraform workflow.
D:substr returns characters starting at an offset with the specified length rather than splitting on a delimiter; this mechanism is useful when the job is to extract a specific range of characters from a string, whereas the current scenario requires the engineer to render a file containing template expressions with an object of variables. These operations have different effects in the stated Terraform workflow.
F:compact filters out null or empty-string members from a string list, preserving usable elements; this mechanism is useful when the job is to remove empty string elements from a list, whereas the current scenario requires the engineer to render a file containing template expressions with an object of variables. These operations have different effects in the stated Terraform workflow.
Question 700
During one infrastructure delivery, the team must satisfy all of the following: (1) remove dependent resources before objects they rely on; (2) run declarative module tests instead of only checking syntax; (3) inject partial backend settings at initialization time. Select THREE appropriate Terraform approaches. Choose THREE.
- terraform plan -destroy
- Dependency-aware deletion
- terraform validate
- terraform init -backend-config
- terraform test
- Repeatable initialization
Explanation
Correct Answers
B:Terraform generally reverses dependency order when destroying managed resources so dependent objects are removed first; this meets the requirement to remove dependent resources before objects they rely on, while the other selected techniques address run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time, which require their own distinct Terraform mechanisms.
D:This option provides backend configuration values separately from static code, although locally cached backend settings may still contain secrets; this meets the requirement to inject partial backend settings at initialization time, while the other selected techniques address remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax, which require their own distinct Terraform mechanisms.
E:The Terraform test command executes defined test runs and assertions, which can exercise behavior beyond basic configuration validation; this meets the requirement to run declarative module tests instead of only checking syntax, while the other selected techniques address remove dependent resources before objects they rely on and inject partial backend settings at initialization time, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:Destroy planning shows the deletion proposal without carrying out the deletion until apply; it addresses review an all-destroy plan before approving resource deletion, but this delivery instead requires remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time. The required combination involves terraform init -backend-config and terraform test and Dependency-aware deletion, not the behavior of terraform plan -destroy.
C:The validate command checks syntax and schema consistency in an initialized configuration without obtaining a full execution plan; it addresses check that Terraform configuration is structurally valid without planning resource changes, but this delivery instead requires remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time. The required combination involves terraform init -backend-config and terraform test and Dependency-aware deletion, not the behavior of terraform validate.
F:terraform init is designed to be safely rerun; when requirements are unchanged, it generally keeps existing setup; it addresses run initialization again in an already prepared directory without unnecessary changes, but this delivery instead requires remove dependent resources before objects they rely on and run declarative module tests instead of only checking syntax and inject partial backend settings at initialization time. The required combination involves terraform init -backend-config and terraform test and Dependency-aware deletion, not the behavior of Repeatable initialization.