Question 170
A new Terraform working directory has a concrete implementation goal: prevent concurrent state writers from overwriting each other's updates. What is the most appropriate Terraform mechanism?
- State snapshots
- Remote state sharing boundaries
- State access protection
- State locking
Explanation
Correct Answer
D:A backend with state-locking support obtains a lock during operations that can modify state, avoiding conflicting simultaneous writes; this directly meets the requirement to prevent concurrent state writers from overwriting each other's updates. By comparison, state snapshots is intended to preserve Terraform's knowledge of managed infrastructure between CLI runs, which is a different task from prevent concurrent state writers from overwriting each other's updates.
Incorrect Answers
A:The state snapshot records managed instance data and metadata needed to plan future actions; this mechanism is useful when the job is to preserve Terraform's knowledge of managed infrastructure between CLI runs, whereas the current scenario requires the engineer to prevent concurrent state writers from overwriting each other's updates. These operations have different effects in the stated Terraform workflow.
B:Reading a remote state output still requires access to the underlying snapshot; exporting data through a narrower interface can reduce exposure; this mechanism is useful when the job is to avoid exposing full state when another stack only needs a published identifier, whereas the current scenario requires the engineer to prevent concurrent state writers from overwriting each other's updates. These operations have different effects in the stated Terraform workflow.
C:State may contain secret values even when CLI output is redacted, so storage encryption and access controls matter; this mechanism is useful when the job is to treat a Terraform state file as potentially sensitive data, whereas the current scenario requires the engineer to prevent concurrent state writers from overwriting each other's updates. These operations have different effects in the stated Terraform workflow.
Question 171
An engineer intends to detect that a state snapshot belongs to a different history or older generation and is reviewing “Serial and lineage checks”. What consequence follows from using it as intended?
- Import commands require the provider-defined identity format, not an arbitrary local Terraform block label.
- A plan does not discover every unmanaged object in an account; its normal focus is tracked resources and configured data sources.
- A data block can read an external object's attributes while avoiding taking over its create-update-delete lifecycle.
- State metadata such as lineage and serial helps protect against incompatible or stale state updates.
Explanation
Correct Answer
D:The named mechanism is used when the objective is to detect that a state snapshot belongs to a different history or older generation, so it produces the behavior described. In contrast, import IDs defined by providers serves a different goal: map an existing object's correct remote identifier to a Terraform address, not detect that a state snapshot belongs to a different history or older generation.
Incorrect Answers
A:The description applies to import IDs defined by providers when an engineer needs to map an existing object's correct remote identifier to a Terraform address; the named serial and lineage checks instead handles the requirement to detect that a state snapshot belongs to a different history or older generation, so this behavior does not describe Serial and lineage checks in the situation named.
B:The description applies to drift detection boundaries when an engineer needs to understand that Terraform only examines infrastructure represented in its configuration or state scope; the named serial and lineage checks instead handles the requirement to detect that a state snapshot belongs to a different history or older generation, so this behavior does not describe Serial and lineage checks in the situation named.
C:The description applies to a data source instead of import when an engineer needs to refer to shared infrastructure that another stack owns without changing its lifecycle; the named serial and lineage checks instead handles the requirement to detect that a state snapshot belongs to a different history or older generation, so this behavior does not describe Serial and lineage checks in the situation named.
Question 172
During a design review, the requirement is to move an established project to remote state without abandoning resource identity. Which option should the engineer select?
- Local state in CI
- The terraform.tfstate file
- State migration from local storage
- Local workspace state directories
Explanation
Correct Answer
C:Changing the root backend and running init -migrate-state can transfer the existing snapshot to the newly configured destination; this directly meets the requirement to move an established project to remote state without abandoning resource identity. By comparison, local workspace state directories is intended to identify how the local backend stores nondefault workspaces, which is a different task from move an established project to remote state without abandoning resource identity.
Incorrect Answers
A:A temporary runner may lose its filesystem after a job, so durable shared state is usually needed for repeatable team automation; this mechanism is useful when the job is to recognize why ephemeral build agents should not rely on a machine-local state file, whereas the current scenario requires the engineer to move an established project to remote state without abandoning resource identity. These operations have different effects in the stated Terraform workflow.
B:The default workspace's local state is kept as terraform.tfstate; this file may contain sensitive infrastructure details; this mechanism is useful when the job is to identify Terraform's default local state artifact, whereas the current scenario requires the engineer to move an established project to remote state without abandoning resource identity. These operations have different effects in the stated Terraform workflow.
D:When local workspaces are used, nondefault state snapshots are placed under a terraform.tfstate.d directory structure; this mechanism is useful when the job is to identify how the local backend stores nondefault workspaces, whereas the current scenario requires the engineer to move an established project to remote state without abandoning resource identity. These operations have different effects in the stated Terraform workflow.
Question 173
Reviewers reject “Terraform Core” as a way to determine which arguments a resource type accepts. Which actual behavior explains why the proposal is unsuitable?
- Terraform Core handles language evaluation, planning and state orchestration while provider plugins execute service-specific operations.
- The namespace portion of a source address separates provider publishers in the registry.
- Terraform checks downloaded provider package checksums against lock information where hashes are available.
- The provider declares accepted resource arguments and computed attributes; Terraform validates configuration against that schema.
Explanation
Correct Answer
A:Terraform Core is used when an operator needs to evaluate HCL expressions and calculate a resource dependency graph. Consequently, this choice cannot meet the separate requirement to determine which arguments a resource type accepts. The intended action would instead require Provider-defined resource schemas.
Incorrect Answers
B:This behavior belongs to The provider registry namespace, which helps engineers identify the publisher when providers share a type name rather than satisfying the separate requirement to determine which arguments a resource type accepts. The attempted technique was Terraform Core; it would instead be used to evaluate HCL expressions and calculate a resource dependency graph, not to produce the effect associated with The provider registry namespace.
C:This behavior belongs to Provider integrity hashes, which helps engineers detect a mismatched plugin distribution package rather than satisfying the separate requirement to determine which arguments a resource type accepts. The attempted technique was Terraform Core; it would instead be used to evaluate HCL expressions and calculate a resource dependency graph, not to produce the effect associated with Provider integrity hashes.
D:That outcome belongs to Provider-defined resource schemas, the mechanism that can determine which arguments a resource type accepts. The question concerns the engineer’s actual proposal, Terraform Core; it is directed at evaluate HCL expressions and calculate a resource dependency graph, not that result.
Question 174
A Terraform state maintenance procedure requires a way to avoid conflicting state updates during concurrent deployments. Which Terraform approach most directly fulfills that request?
- Not disabling locking for speed
- Lock release after completion
- A lock identifier
- Backend-specific lock support
Explanation
Correct Answer
A:The -lock=false option bypasses locking safeguards and increases the risk of two runs writing inconsistent state; this directly meets the requirement to avoid conflicting state updates during concurrent deployments. By comparison, a lock identifier is intended to ensure a force-unlock targets the correct held state lock, which is a different task from avoid conflicting state updates during concurrent deployments.
Incorrect Answers
B:Terraform obtains and releases supported backend locks around state-sensitive operations; a crash can sometimes leave manual recovery necessary; this mechanism is useful when the job is to understand why a normal Terraform operation frees the lock, whereas the current scenario requires the engineer to avoid conflicting state updates during concurrent deployments. These operations have different effects in the stated Terraform workflow.
C:Terraform uses lock information to distinguish a specific operation's lock from unrelated lock holders; this mechanism is useful when the job is to ensure a force-unlock targets the correct held state lock, whereas the current scenario requires the engineer to avoid conflicting state updates during concurrent deployments. These operations have different effects in the stated Terraform workflow.
D:Backend state locking behavior depends on the backend implementation; remote storage alone does not guarantee safe locking; this mechanism is useful when the job is to check whether a chosen remote backend actually offers state locking, whereas the current scenario requires the engineer to avoid conflicting state updates during concurrent deployments. These operations have different effects in the stated Terraform workflow.
Question 175
A Terraform deployment has independent requirements: (1) represent managed infrastructure using Terraform's native declarative language; (2) authorize Terraform separately for two different infrastructure APIs. Which TWO mechanisms directly address these needs? Choose TWO.
- Consistent automation pipeline
- State-backed object tracking
- Provider authentication per service
- HCL configuration files
- Version-controlled infrastructure definition
- Repeatable environment definition
Explanation
Correct Answers
C:Each provider configuration supplies or discovers credentials appropriate to the API it calls, rather than sharing a universal Terraform credential; this meets the requirement to authorize Terraform separately for two different infrastructure APIs, while the other selected techniques address represent managed infrastructure using Terraform's native declarative language, which require their own distinct Terraform mechanisms.
D:Terraform reads .tf files written in HCL, including blocks, arguments, expressions and references that describe the intended objects; this meets the requirement to represent managed infrastructure using Terraform's native declarative language, while the other selected techniques address authorize Terraform separately for two different infrastructure APIs, which require their own distinct Terraform mechanisms.
Incorrect Answers
A:Terraform's core workflow works across providers even though their individual resources and authentication methods differ; it addresses apply the same validate-plan-apply lifecycle to more than one cloud, but this delivery instead requires represent managed infrastructure using Terraform's native declarative language and authorize Terraform separately for two different infrastructure APIs. The required combination involves HCL configuration files and Provider authentication per service, not the behavior of Consistent automation pipeline.
B:Terraform state records mappings and attributes needed to compare future plans without rediscovering every object's identity from scratch; it addresses retain the association between a configuration address and its actual managed object, but this delivery instead requires represent managed infrastructure using Terraform's native declarative language and authorize Terraform separately for two different infrastructure APIs. The required combination involves HCL configuration files and Provider authentication per service, not the behavior of State-backed object tracking.
E:Infrastructure configuration can be committed and reviewed in version control so the intended change is traceable before a Terraform run; it addresses review a proposed infrastructure change before team members deploy it, but this delivery instead requires represent managed infrastructure using Terraform's native declarative language and authorize Terraform separately for two different infrastructure APIs. The required combination involves HCL configuration files and Provider authentication per service, not the behavior of Version-controlled infrastructure definition.
F:IaC configuration provides repeatable definitions; variables and isolated state allow environments to differ without independently hand-building each object; it addresses recreate the same logical infrastructure design across test and production, but this delivery instead requires represent managed infrastructure using Terraform's native declarative language and authorize Terraform separately for two different infrastructure APIs. The required combination involves HCL configuration files and Provider authentication per service, not the behavior of Repeatable environment definition.
Question 176
A Terraform runbook prescribes “The required_providers block” to install approved plugins from an internal distribution location, but it does not meet the requirement. What does that step actually accomplish?
- The -upgrade switch permits newer versions that satisfy constraints instead of preserving current installed or locked selections.
- A CLI provider_installation configuration can direct provider package discovery to a network or filesystem mirror.
- A required_providers entry maps a local provider name to its source address and version constraint; it does not configure API credentials.
- The providers lock subcommand updates dependency lock information, including hashes for specified target operating-system platforms.
Explanation
Correct Answer
C:The required_providers block is used when an operator needs to declare where a provider plugin comes from and which versions are acceptable. Consequently, this choice cannot meet the separate requirement to install approved plugins from an internal distribution location. The intended action would instead require A provider mirror.
Incorrect Answers
A:This behavior belongs to terraform init -upgrade, which helps engineers intentionally reconsider previously locked provider and module selections rather than satisfying the separate requirement to install approved plugins from an internal distribution location. The attempted technique was The required_providers block; it would instead be used to declare where a provider plugin comes from and which versions are acceptable, not to produce the effect associated with terraform init -upgrade.
B:That outcome belongs to A provider mirror, the mechanism that can install approved plugins from an internal distribution location. The question concerns the engineer’s actual proposal, The required_providers block; it is directed at declare where a provider plugin comes from and which versions are acceptable, not that result.
D:This behavior belongs to terraform providers lock, which helps engineers populate provider package checksums for selected platforms rather than satisfying the separate requirement to install approved plugins from an internal distribution location. The attempted technique was The required_providers block; it would instead be used to declare where a provider plugin comes from and which versions are acceptable, not to produce the effect associated with terraform providers lock.
Question 177
An engineer proposes “Module composition” to create one child module instance for each stable application key. Which outcome does the proposed technique actually provide?
- Parent configurations can pass one child module's outputs into another child's inputs to compose larger infrastructure systems.
- All Terraform configuration files in a module directory are combined as one module; filenames do not define separate execution units.
- The for_each meta-argument instantiates keyed module instances addressable as module.NAME["key"].
- depends_on on a module call affects all resources and data sources inside that module and can constrain concurrency.
Explanation
Correct Answer
A:Module composition is used when an operator needs to combine small modules into a root configuration without producing one giant module. Consequently, this choice cannot meet the separate requirement to create one child module instance for each stable application key. The intended action would instead require A module with for_each.
Incorrect Answers
B:This behavior belongs to A module root directory, which helps engineers understand which source files Terraform loads as one module rather than satisfying the separate requirement to create one child module instance for each stable application key. The attempted technique was Module composition; it would instead be used to combine small modules into a root configuration without producing one giant module, not to produce the effect associated with A module root directory.
C:That outcome belongs to A module with for_each, the mechanism that can create one child module instance for each stable application key. The question concerns the engineer’s actual proposal, Module composition; it is directed at combine small modules into a root configuration without producing one giant module, not that result.
D:This behavior belongs to Module-level depends_on, which helps engineers create an explicit ordering edge for module resources that have a real hidden dependency rather than satisfying the separate requirement to create one child module instance for each stable application key. The attempted technique was Module composition; it would instead be used to combine small modules into a root configuration without producing one giant module, not to produce the effect associated with Module-level depends_on.
Question 178
An operations team replacing ad-hoc scripts requires a way to catch undesirable configuration changes before deployment. Which Terraform approach most directly fulfills that request?
- Environment parametrization
- Code review of infrastructure
- Reusing modules
- Idempotent convergence
Explanation
Correct Answer
B:A version-control pull request can expose infrastructure edits to peer review, policy checks and automated validation; this directly meets the requirement to catch undesirable configuration changes before deployment. By comparison, environment parametrization is intended to deploy similarly structured stacks with environment-specific settings, which is a different task from catch undesirable configuration changes before deployment.
Incorrect Answers
A:Terraform input variables permit different values for capacity, names and endpoints without copying the entire resource definition; this mechanism is useful when the job is to deploy similarly structured stacks with environment-specific settings, whereas the current scenario requires the engineer to catch undesirable configuration changes before deployment. These operations have different effects in the stated Terraform workflow.
C:A module packages input variables, resources and outputs so callers can reuse a consistent infrastructure design; this mechanism is useful when the job is to standardize a reusable network pattern across multiple applications, whereas the current scenario requires the engineer to catch undesirable configuration changes before deployment. These operations have different effects in the stated Terraform workflow.
D: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 catch undesirable configuration changes before deployment. These operations have different effects in the stated Terraform workflow.
Question 179
An engineer proposes “Write configuration first” to inspect predicted create, update and delete actions prior to making changes. Which outcome does the proposed technique actually provide?
- A revised configuration must be planned again because a prior plan does not automatically incorporate later edits.
- The workflow begins by declaring resources, inputs and dependencies that describe what Terraform should manage.
- Following apply, output values and state inspection can reveal created identifiers while a new plan can test for remaining drift.
- The plan stage compares desired configuration with observed resource state and shows the proposed operations for review.
Explanation
Correct Answer
B:Write configuration first is used when an operator needs to express the intended infrastructure before asking Terraform for a plan. Consequently, this choice cannot meet the separate requirement to inspect predicted create, update and delete actions prior to making changes. The intended action would instead require Review a plan before apply.
Incorrect Answers
A:This behavior belongs to Iterate after feedback, which helps engineers modify and re-plan after a change request is rejected rather than satisfying the separate requirement to inspect predicted create, update and delete actions prior to making changes. The attempted technique was Write configuration first; it would instead be used to express the intended infrastructure before asking Terraform for a plan, not to produce the effect associated with Iterate after feedback.
C:This behavior belongs to Check infrastructure after apply, which helps engineers confirm deployed outputs and state match the expected result rather than satisfying the separate requirement to inspect predicted create, update and delete actions prior to making changes. The attempted technique was Write configuration first; it would instead be used to express the intended infrastructure before asking Terraform for a plan, not to produce the effect associated with Check infrastructure after apply.
D:That outcome belongs to Review a plan before apply, the mechanism that can inspect predicted create, update and delete actions prior to making changes. The question concerns the engineer’s actual proposal, Write configuration first; it is directed at express the intended infrastructure before asking Terraform for a plan, not that result.
Question 180
During a design review, the requirement is to supply a single variable assignment when invoking plan or apply. Which option should the engineer select?
- terraform output -json
- terraform output -raw
- The -var option
- A child module output block
Explanation
Correct Answer
C:Command-line -var assignments take high precedence and are useful for an explicit run-specific override; this directly meets the requirement to supply a single variable assignment when invoking plan or apply. By comparison, a child module output block is intended to make a child module's private resource attribute available to its caller, which is a different task from supply a single variable assignment when invoking plan or apply.
Incorrect Answers
A:The JSON output mode serializes output values and metadata for automation; it can expose sensitive values and must be protected; this mechanism is useful when the job is to retrieve root outputs for integration with another program, whereas the current scenario requires the engineer to supply a single variable assignment when invoking plan or apply. These operations have different effects in the stated Terraform workflow.
B: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 supply a single variable assignment when invoking plan or apply. These operations have different effects in the stated Terraform workflow.
D: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 supply a single variable assignment when invoking plan or apply. These operations have different effects in the stated Terraform workflow.