Question 1050
During a design review, the requirement is to avoid unintended changes immediately after importing a remote object. Which option should the engineer select?
- An import configuration review
- The import block
- Provider permissions during import
- A matching resource declaration
Explanation
Correct Answer
D:Imported infrastructure should have a corresponding resource block with configuration matching the desired attributes so the next plan is safe; this directly meets the requirement to avoid unintended changes immediately after importing a remote object. By comparison, an import configuration review is intended to correct provider-generated HCL rather than trusting every inferred argument, which is a different task from avoid unintended changes immediately after importing a remote object.
Incorrect Answers
A:Generated resource declarations are a starting point and can include computed or unsuitable attributes requiring manual cleanup; this mechanism is useful when the job is to correct provider-generated HCL rather than trusting every inferred argument, whereas the current scenario requires the engineer to avoid unintended changes immediately after importing a remote object. These operations have different effects in the stated Terraform workflow.
B:A top-level import block identifies a target resource address and import identity so the operation participates in plan and apply; this mechanism is useful when the job is to declare a managed import operation in configuration for planning and applying, whereas the current scenario requires the engineer to avoid unintended changes immediately after importing a remote object. These operations have different effects in the stated Terraform workflow.
C:Import needs correct provider authentication and sufficient access to query the target resource using its provider-defined import ID; this mechanism is useful when the job is to read an existing cloud object so Terraform can associate it with state, whereas the current scenario requires the engineer to avoid unintended changes immediately after importing a remote object. These operations have different effects in the stated Terraform workflow.
Question 1051
A change request asks an engineer to separate independent business units with different governance needs. Which choice best implements the requested behavior?
- A tagged cloud workspaces block
- Project-scoped team access
- HCP Terraform organization separation
- HCP Terraform run triggers between workspaces
Explanation
Correct Answer
C:Organizations provide a broader boundary containing projects, workspaces, teams and policy configuration; this directly meets the requirement to separate independent business units with different governance needs. By comparison, a tagged cloud workspaces block is intended to select workspaces using Terraform cloud configuration rather than a single explicit name, which is a different task from separate independent business units with different governance needs.
Incorrect Answers
A:The cloud block can select a workspace set by supported tags, which differs from specifying one workspace name; this mechanism is useful when the job is to select workspaces using Terraform cloud configuration rather than a single explicit name, whereas the current scenario requires the engineer to separate independent business units with different governance needs. These operations have different effects in the stated Terraform workflow.
B:Project-level access scopes workspace capabilities for teams based on organizational boundaries; this mechanism is useful when the job is to delegate administration of one team's project without granting universal organization access, whereas the current scenario requires the engineer to separate independent business units with different governance needs. These operations have different effects in the stated Terraform workflow.
D:A run trigger can initiate a downstream plan when its designated upstream workspace completes the relevant run; this mechanism is useful when the job is to coordinate a dependent app deployment following an upstream network workspace apply, whereas the current scenario requires the engineer to separate independent business units with different governance needs. These operations have different effects in the stated Terraform workflow.
Question 1052
A change request asks an engineer to create an explicit ordering edge for module resources that have a real hidden dependency. Which choice best implements the requested behavior?
- Using a module registry version
- A module dependency interface
- Module composition
- Module-level depends_on
- A module root directory
Explanation
Correct Answer
D:depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency; this directly meets the requirement to create an explicit ordering edge for module resources that have a real hidden dependency. By comparison, a module root directory is intended to understand which source files Terraform loads as one module, which is a different task from create an explicit ordering edge for module resources that have a real hidden dependency.
Incorrect Answers
A:The module block's version argument can constrain registry modules and is separate from Terraform CLI and provider version settings; this concerns the task to control which published module release a root configuration consumes, not the current need to create an explicit ordering edge for module resources that have a real hidden dependency. A Module-level depends_on approach is appropriate here; the substituted Using a module registry version option does not supply the specified Terraform capability.
B: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 create an explicit ordering edge for module resources that have a real hidden dependency. These operations have different effects in the stated Terraform workflow.
C:Parent configurations can pass one child module's outputs into another child's inputs to compose larger infrastructure systems; this mechanism is useful when the job is to combine small modules into a root configuration without producing one giant module, whereas the current scenario requires the engineer to create an explicit ordering edge for module resources that have a real hidden dependency. These operations have different effects in the stated Terraform workflow.
E:All Terraform configuration files in a module directory are combined as one module; filenames do not define separate execution units; this mechanism is useful when the job is to understand which source files Terraform loads as one module, whereas the current scenario requires the engineer to create an explicit ordering edge for module resources that have a real hidden dependency. These operations have different effects in the stated Terraform workflow.
Question 1053
A team compares Terraform mechanisms for the goal to determine a module's declared inputs, outputs, providers and usage examples. Which stated consequence belongs specifically to “Registry module documentation”?
- Keeping reusable child modules separately versioned allows independent adoption and maintenance by different Terraform root modules.
- Published module documentation and metadata describe the module interface and help consumers understand required arguments.
- The terraform get command updates downloaded module sources only; routine workflows generally prefer terraform init.
- A git::https:// source can retrieve a Terraform module from version control rather than from the module registry.
Explanation
Correct Answer
B:The named mechanism is used when the objective is to determine a module's declared inputs, outputs, providers and usage examples, so it produces the behavior described. In contrast, a separate module repository serves a different goal: share reusable Terraform configuration with multiple root projects, not determine a module's declared inputs, outputs, providers and usage examples.
Incorrect Answers
A:The description applies to a separate module repository when an engineer needs to share reusable Terraform configuration with multiple root projects; the named registry module documentation instead handles the requirement to determine a module's declared inputs, outputs, providers and usage examples, so this behavior does not describe Registry module documentation in the situation named.
C:The description applies to terraform get when an engineer needs to retrieve child modules without running the complete backend and provider setup steps; the named registry module documentation instead handles the requirement to determine a module's declared inputs, outputs, providers and usage examples, so this behavior does not describe Registry module documentation in the situation named.
D:The description applies to a Git HTTPS module source when an engineer needs to fetch module code directly from a remote Git repository; the named registry module documentation instead handles the requirement to determine a module's declared inputs, outputs, providers and usage examples, so this behavior does not describe Registry module documentation in the situation named.
Question 1054
During an infrastructure design review about how to avoid unintended changes immediately after importing a remote object, a maintainer asks what “A matching resource declaration” does. Which description is accurate?
- Imported infrastructure should have a corresponding resource block with configuration matching the desired attributes so the next plan is safe.
- A top-level import block identifies a target resource address and import identity so the operation participates in plan and apply.
- Provider documentation determines the required import identity; it may be an ID or compound identifier depending on resource type.
- The to argument points to an intended Terraform resource address rather than a provider account name or state backend.
Explanation
Correct Answer
A:The named mechanism is used when the objective is to avoid unintended changes immediately after importing a remote object, so it produces the behavior described. In contrast, the import block serves a different goal: declare a managed import operation in configuration for planning and applying, not avoid unintended changes immediately after importing a remote object.
Incorrect Answers
B:The description applies to the import block when an engineer needs to declare a managed import operation in configuration for planning and applying; the named a matching resource declaration instead handles the requirement to avoid unintended changes immediately after importing a remote object, so this behavior does not describe A matching resource declaration in the situation named.
C:The description applies to an import block's id argument when an engineer needs to supply the remote identifier in the format accepted by the resource's provider; the named a matching resource declaration instead handles the requirement to avoid unintended changes immediately after importing a remote object, so this behavior does not describe A matching resource declaration in the situation named.
D:The description applies to an import block's to argument when an engineer needs to specify which resource instance address should receive the imported object; the named a matching resource declaration instead handles the requirement to avoid unintended changes immediately after importing a remote object, so this behavior does not describe A matching resource declaration in the situation named.
Question 1055
A reusable infrastructure definition requires a way to accept an omitted field in a structured object input. Which Terraform approach most directly fulfills that request?
- A map of strings type
- tomap conversion
- An optional object attribute
- Avoiding index churn with for_each
Explanation
Correct Answer
C:The optional type modifier inside an object constraint allows the caller to omit a field and optionally sets a default; this directly meets the requirement to accept an omitted field in a structured object input. By comparison, a map of strings type is intended to associate arbitrary string keys with string values, which is a different task from accept an omitted field in a structured object input.
Incorrect Answers
A:The map(string) type models uniform values accessed by key rather than by positional index; this mechanism is useful when the job is to associate arbitrary string keys with string values, whereas the current scenario requires the engineer to accept an omitted field in a structured object input. These operations have different effects in the stated Terraform workflow.
B:tomap attempts to convert an input value into a map whose values share a compatible element type; this mechanism is useful when the job is to turn a compatible collection into a uniform-keyed map, whereas the current scenario requires the engineer to accept an omitted field in a structured object input. These operations have different effects in the stated Terraform workflow.
D:Keyed for_each instances use stable identifiers, whereas count indexes can shift when list elements are deleted; this mechanism is useful when the job is to preserve instance identity when a middle collection item is removed, whereas the current scenario requires the engineer to accept an omitted field in a structured object input. These operations have different effects in the stated Terraform workflow.
Question 1056
A declarative resource and expression design requires a way to calculate a nested network prefix from a parent CIDR range. Which Terraform approach most directly fulfills that request?
- The ternary conditional operator
- The format function
- The cidrsubnet function
- The for expression
Explanation
Correct Answer
C:cidrsubnet derives a subnet CIDR using additional prefix bits and a network number, without provisioning a network resource; this directly meets the requirement to calculate a nested network prefix from a parent CIDR range. By comparison, the ternary conditional operator is intended to set a resource argument according to a boolean expression, which is a different task from calculate a nested network prefix from a parent CIDR range.
Incorrect Answers
A:The condition ? value_a : value_b expression chooses a suitable branch without creating duplicate resource blocks; this mechanism is useful when the job is to set a resource argument according to a boolean expression, whereas the current scenario requires the engineer to calculate a nested network prefix from a parent CIDR range. These operations have different effects in the stated Terraform workflow.
B:format interpolates arguments into a printf-style string template for predictable names or identifiers; this mechanism is useful when the job is to build formatted text using placeholders for typed values, whereas the current scenario requires the engineer to calculate a nested network prefix from a parent CIDR range. These operations have different effects in the stated Terraform workflow.
D: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 calculate a nested network prefix from a parent CIDR range. These operations have different effects in the stated Terraform workflow.
Question 1057
An HCP Terraform workspace design requires a way to attach a shared governance policy collection to selected workspace scopes. Which Terraform approach most directly fulfills that request?
- HCP Terraform run tasks
- Drift detection in HCP Terraform
- The HCP private module registry
- Policy sets
- Project-based permission boundaries
Explanation
Correct Answer
D:Policy sets organize policy rules and their workspace or project applicability rather than modifying provider schemas directly; this directly meets the requirement to attach a shared governance policy collection to selected workspace scopes. By comparison, HCP Terraform run tasks is intended to integrate external checks into a run before applying infrastructure changes, which is a different task from attach a shared governance policy collection to selected workspace scopes.
Incorrect Answers
A:Run tasks send run context to integrated systems and can participate in checks or approval workflows, depending on configuration; this mechanism is useful when the job is to integrate external checks into a run before applying infrastructure changes, whereas the current scenario requires the engineer to attach a shared governance policy collection to selected workspace scopes. These operations have different effects in the stated Terraform workflow.
B:HCP Terraform health features can detect changes made outside the workspace's managed Terraform workflow; this mechanism is useful when the job is to identify remote infrastructure deviations through scheduled or managed health assessments, whereas the current scenario requires the engineer to attach a shared governance policy collection to selected workspace scopes. These operations have different effects in the stated Terraform workflow.
C:Private registry modules can be published, versioned and discovered by authorized HCP Terraform users; this mechanism is useful when the job is to share approved modules with organization members without relying on public registry visibility, whereas the current scenario requires the engineer to attach a shared governance policy collection to selected workspace scopes. These operations have different effects in the stated Terraform workflow.
E:Projects group workspaces and support scoped access management for organizational teams; this mechanism is useful when the job is to delegate administration of grouped HCP Terraform workspaces, whereas the current scenario requires the engineer to attach a shared governance policy collection to selected workspace scopes. These operations have different effects in the stated Terraform workflow.
Question 1058
During one infrastructure delivery, the team must satisfy all of the following: (1) monitor whether infrastructure-specific check assertions still pass after deployment; (2) authorize a Terraform CLI workflow to access an HCP Terraform organization. Select TWO appropriate Terraform approaches. Choose TWO.
- HCP continuous validation
- A cloud block project selector
- terraform init after adding cloud integration
- An API token for CLI connectivity
- Workspace audit history
Explanation
Correct Answers
A:Continuous validation can evaluate configuration check blocks to identify operational health issues in supported workspaces; this meets the requirement to monitor whether infrastructure-specific check assertions still pass after deployment, while the other selected techniques address authorize a Terraform CLI workflow to access an HCP Terraform organization, which require their own distinct Terraform mechanisms.
D: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 monitor whether infrastructure-specific check assertions still pass after deployment, which require their own distinct Terraform mechanisms.
Incorrect Answers
B:The cloud workspaces block supports a project setting for organizing related workspace integration; it addresses associate an HCP Terraform workspace with an intended project during configuration, but this delivery instead requires monitor whether infrastructure-specific check assertions still pass after deployment and authorize a Terraform CLI workflow to access an HCP Terraform organization. The required combination involves HCP continuous validation and An API token for CLI connectivity, not the behavior of A cloud block project selector.
C:Running init processes the cloud block and configures workspace connectivity before plans or applies; it addresses configure the local working directory to connect with the selected HCP workspace, but this delivery instead requires monitor whether infrastructure-specific check assertions still pass after deployment and authorize a Terraform CLI workflow to access an HCP Terraform organization. The required combination involves HCP continuous validation and An API token for CLI connectivity, not the behavior of terraform init after adding cloud integration.
E:Run history records plan and apply activity to support team review and change tracking; it addresses review past runs and changes in a shared HCP organization, but this delivery instead requires monitor whether infrastructure-specific check assertions still pass after deployment and authorize a Terraform CLI workflow to access an HCP Terraform organization. The required combination involves HCP continuous validation and An API token for CLI connectivity, not the behavior of Workspace audit history.
Question 1059
A new Terraform working directory requires a way to declare where a provider plugin comes from and which versions are acceptable. Which Terraform approach most directly fulfills that request?
- terraform init -upgrade
- terraform init
- terraform providers lock
- The required_providers block
- The dependency lock file
Explanation
Correct Answer
D:A required_providers entry maps a local provider name to its source address and version constraint; it does not configure API credentials; this directly meets the requirement to declare where a provider plugin comes from and which versions are acceptable. By comparison, terraform init is intended to download missing required provider plugins before planning, which is a different task from declare where a provider plugin comes from and which versions are acceptable.
Incorrect Answers
A:The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections; this mechanism is useful when the job is to intentionally reconsider previously locked provider and module selections, whereas the current scenario requires the engineer to declare where a provider plugin comes from and which versions are acceptable. These operations have different effects in the stated Terraform workflow.
B:Initialization resolves provider requirements, installs plugins, and prepares modules and backend settings in the working directory; this mechanism is useful when the job is to download missing required provider plugins before planning, whereas the current scenario requires the engineer to declare where a provider plugin comes from and which versions are acceptable. These operations have different effects in the stated Terraform workflow.
C:The providers lock subcommand updates dependency lock information, including hashes for specified target operating-system platforms; this mechanism is useful when the job is to populate provider package checksums for selected platforms, whereas the current scenario requires the engineer to declare where a provider plugin comes from and which versions are acceptable. These operations have different effects in the stated Terraform workflow.
E:The .terraform.lock.hcl file records selected provider versions and checksums to constrain subsequent installations; this mechanism is useful when the job is to reproduce previously selected provider package versions on other machines, whereas the current scenario requires the engineer to declare where a provider plugin comes from and which versions are acceptable. These operations have different effects in the stated Terraform workflow.
Question 1060
A build job for a Terraform configuration needs to interpret a plan showing a resource that Terraform will destroy. Which feature or operation is the most direct match?
- The dependency graph during planning
- A resource action marked minus
- terraform plan -refresh=false
- terraform plan -replace
Explanation
Correct Answer
B:In human-readable plans, - denotes a planned destruction of a managed resource; this directly meets the requirement to interpret a plan showing a resource that Terraform will destroy. By comparison, terraform plan -refresh=false is intended to skip routine state refresh for a constrained preview, which is a different task from interpret a plan showing a resource that Terraform will destroy.
Incorrect Answers
A: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 interpret a plan showing a resource that Terraform will destroy. These operations have different effects in the stated Terraform workflow.
C:Disabling refresh reduces remote reads but can hide drift and produce an inaccurate plan based on stale observations; this mechanism is useful when the job is to skip routine state refresh for a constrained preview, whereas the current scenario requires the engineer to interpret a plan showing a resource that Terraform will destroy. These operations have different effects in the stated Terraform workflow.
D:The -replace=ADDRESS option requests replacement of a particular managed instance even if ordinary change detection would update it in place or do nothing; this mechanism is useful when the job is to force a resource instance to be replaced during planning, whereas the current scenario requires the engineer to interpret a plan showing a resource that Terraform will destroy. These operations have different effects in the stated Terraform workflow.