100% Latest & Updated HashiCorp Terraform Associate 004 Practice Test Questions, Exam Dumps & Verified Answers!
30 Days Free Updates, Instant Download!
Question 330
A Terraform platform team is coordinating 3 independent decisions. Workstream A: A database API supports a write-only password argument and the team must avoid persisting the initial password to state. and Workstream B: An operator leaves TF_LOG=TRACE enabled in production for all runs and sees excessive potentially sensitive logs. and Workstream C: An engineer clones a Terraform repository and sees an error that provider plugins are not installed. Select exactly 3 actions, one addressing each distinct workstream.
- Create an HCP Terraform workspace and configure an appropriate remote execution workflow with secure credentials.
- Use an advisory policy enforcement setting on the learning workspaces and monitor the warnings.
- Use the cloud integration block for workspace mapping and authenticate with terraform login securely.
- Use a provider-supported write-only argument, optionally supplied by an ephemeral value, with appropriate versioning.
- Run terraform init in the root module directory to initialize backend, modules, and providers.
- Disable or lower TF_LOG after collecting the targeted diagnostic evidence.
Explanation
Correct Answers
D:For the workstream in which a database API supports a write-only password argument and the team must avoid persisting the initial password to state, use this action: Use a provider-supported write-only argument, optionally supplied by an ephemeral value, with appropriate versioning. Write-only arguments are designed to pass temporary values without recording them in state. Verify: The resource operation consumes the password while the Terraform plan and state omit the write-only value. Limitation: Only explicitly write-only provider arguments qualify; an arbitrary normal password argument is not automatically safe.
E:For the workstream in which an engineer clones a Terraform repository and sees an error that provider plugins are not installed, use this action: Run terraform init in the root module directory to initialize backend, modules, and providers. Initialization prepares the workspace rather than applying infrastructure resources. Verify: The .terraform working data and dependency lock file reflect successful initialization. Limitation: Init does not create configured cloud infrastructure merely by installing plugins.
F:For the workstream in which an operator leaves TF_LOG=TRACE enabled in production for all runs and sees excessive potentially sensitive logs, use this action: Disable or lower TF_LOG after collecting the targeted diagnostic evidence. Logging scope and lifecycle must be controlled because verbose provider interaction details can reveal secrets. Verify: Subsequent normal runs no longer emit verbose tracing to the same log destination. Limitation: Disabling logs prevents future emission but does not erase previously collected sensitive log files.
Incorrect Answers
A:This action is appropriate instead for a different, unlisted requirement: A small team needs managed Terraform state and remotely executed infrastructure runs with shared visibility rather than running only from laptops. It would be checked by: Plans and applies run under the HCP workspace and its state versions are centrally accessible to authorized users. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
B:This action is appropriate instead for a different, unlisted requirement: A security team wants engineers to see policy violations without initially blocking learning-environment applies. It would be checked by: Violating plans produce visible advisory policy findings while runs remain allowed to continue. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
C:This action is appropriate instead for a different, unlisted requirement: A local Terraform root must be connected to a specific HCP Terraform workspace without storing an API token in version control. It would be checked by: CLI commands authenticate to the correct HCP organization/workspace and work with managed remote state. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
Question 331
An infrastructure team faces this specific situation: A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. Which Terraform action most directly satisfies the requirement?
- Use lifecycle ignore_changes for the specifically shared tag attribute after agreeing which system owns it.
- Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration.
- Reference the selected data source attribute in the managed resource's image argument.
- Define a resource postcondition that validates the resulting endpoint before dependent resources proceed.
Explanation
Correct Answer
B:Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. Ephemeral variable semantics deliberately limit where transient values may flow. Verify: The ephemeral value is supplied for the operation but omitted from saved state and plan data. Limitation: Ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions.
Incorrect Answers
A:This is linked to a different situation: A managed resource's tag is updated by an external compliance agent, and Terraform must not revert only that tag on every plan. There the relevant decision is: Use lifecycle ignore_changes for the specifically shared tag attribute after agreeing which system owns it. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant decision is: Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A module uses a provider data source to find the newest image and a resource block to launch a VM from its returned identifier. There the relevant decision is: Reference the selected data source attribute in the managed resource's image argument. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant decision is: Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A managed service should not continue to downstream provisioning if the returned endpoint has an invalid structure. There the relevant decision is: Define a resource postcondition that validates the resulting endpoint before dependent resources proceed. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant decision is: Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. It would therefore not resolve or assess the case as stated.
Question 332
A reviewer is confirming a change for the following use case: A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. The implementation follows this approach: Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. Which observation or acceptance test most directly verifies the intended result?
- The selected environment returns the class value under the requested map key.
- A failed check appears as a diagnostic rather than necessarily blocking the run like a precondition.
- A failing postcondition signals an error and prevents downstream dependent actions.
- The ephemeral value is supplied for the operation but omitted from saved state and plan data.
Explanation
Correct Answer
D:Acceptance evidence: The ephemeral value is supplied for the operation but omitted from saved state and plan data. It validates the proposed action, use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration, because ephemeral variable semantics deliberately limit where transient values may flow. Remaining limitation: Ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions.
Incorrect Answers
A:This is linked to a different situation: A configuration needs a map from environment names to individually selected instance classes, with each value a string. There the relevant acceptance is: The selected environment returns the class value under the requested map key. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant acceptance is: The ephemeral value is supplied for the operation but omitted from saved state and plan data. It would therefore not resolve or assess the case as stated.
B:This is linked to a different situation: An operations group wants an infrastructure health assertion that can report a diagnostic without behaving exactly like a resource precondition. There the relevant acceptance is: A failed check appears as a diagnostic rather than necessarily blocking the run like a precondition. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant acceptance is: The ephemeral value is supplied for the operation but omitted from saved state and plan data. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A managed service should not continue to downstream provisioning if the returned endpoint has an invalid structure. There the relevant acceptance is: A failing postcondition signals an error and prevents downstream dependent actions. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant acceptance is: The ephemeral value is supplied for the operation but omitted from saved state and plan data. It would therefore not resolve or assess the case as stated.
Question 333
Consider a proposed solution for this requirement: A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. The team plans to do the following: Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. Which limitation or operational caveat must remain in the review?
- Ignore rules do not ignore the attribute at initial resource creation and can hide meaningful drift if used too broadly.
- Explicit dependencies should be limited to real hidden dependencies; excessive depends_on can make plans conservative.
- The data source requires access and will fail if its lookup criteria match no suitable object.
- Ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions.
Explanation
Correct Answer
D:The limitation is ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions. The proposed change is use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. Validate it by checking the ephemeral value is supplied for the operation but omitted from saved state and plan data. Ephemeral variable semantics deliberately limit where transient values may flow.
Incorrect Answers
A:This is linked to a different situation: A managed resource's tag is updated by an external compliance agent, and Terraform must not revert only that tag on every plan. There the relevant limitation is: Ignore rules do not ignore the attribute at initial resource creation and can hide meaningful drift if used too broadly. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant limitation is: Ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions. It would therefore not resolve or assess the case as stated.
B:This is linked to a different situation: A firewall rule should be provisioned only after a policy attachment exists, but the rule's arguments do not reference that attachment. There the relevant limitation is: Explicit dependencies should be limited to real hidden dependencies; excessive depends_on can make plans conservative. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant limitation is: Ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A web team must create a new load balancer and also look up an existing shared network ID managed by another team. There the relevant limitation is: The data source requires access and will fail if its lookup criteria match no suitable object. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant limitation is: Ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions. It would therefore not resolve or assess the case as stated.
Question 334
The team is reviewing a Terraform implementation for this case: A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. Which tempting assumption would be specifically incorrect for this proposed implementation?
- Assume create_before_destroy guarantees zero downtime even when duplicate names are forbidden.
- Use terraform fmt as a substitute for runtime result invariants on managed objects.
- Set ephemeral=true on a variable and then use it freely in any ordinary output persisted to state.
- Assume every failed check block prevents Terraform from applying all resources.
Explanation
Correct Answer
C:Reject the assumption: Set ephemeral=true on a variable and then use it freely in any ordinary output persisted to state. Instead, use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. Ephemeral variable semantics deliberately limit where transient values may flow. Acceptance evidence: The ephemeral value is supplied for the operation but omitted from saved state and plan data.
Incorrect Answers
A:This is linked to a different situation: A service cannot tolerate downtime when replacing a VM and the provider's planned operation requires destroy-and-create. There the relevant misconception is: Assume create_before_destroy guarantees zero downtime even when duplicate names are forbidden. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant misconception is: Set ephemeral=true on a variable and then use it freely in any ordinary output persisted to state. It would therefore not resolve or assess the case as stated.
B:This is linked to a different situation: A managed service should not continue to downstream provisioning if the returned endpoint has an invalid structure. There the relevant misconception is: Use terraform fmt as a substitute for runtime result invariants on managed objects. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant misconception is: Set ephemeral=true on a variable and then use it freely in any ordinary output persisted to state. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: An operations group wants an infrastructure health assertion that can report a diagnostic without behaving exactly like a resource precondition. There the relevant misconception is: Assume every failed check block prevents Terraform from applying all resources. For the question's actual requirement — A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. — the specifically relevant misconception is: Set ephemeral=true on a variable and then use it freely in any ordinary output persisted to state. It would therefore not resolve or assess the case as stated.
Question 335
A Terraform platform team is coordinating 2 independent decisions. Workstream A: A short-lived token must be used during an operation, and auditors require that the token not be written to a plan file. and Workstream B: A small team needs managed Terraform state and remotely executed infrastructure runs with shared visibility rather than running only from laptops. Select exactly 2 actions, one addressing each distinct workstream.
- Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration.
- Create an HCP Terraform workspace and configure an appropriate remote execution workflow with secure credentials.
- Set TF_LOG and TF_LOG_PATH together, collect the protected log, then disable verbose logging.
- Inspect terraform plan -replace=ADDRESS and review any downstream dependencies before applying.
- Back up the current state and use terraform init -migrate-state when moving to the newly configured backend.
Explanation
Correct Answers
A:For the workstream in which a short-lived token must be used during an operation, and auditors require that the token not be written to a plan file, use this action: Use an ephemeral input value in an allowed Terraform ephemeral context, such as a supported provider configuration. Ephemeral variable semantics deliberately limit where transient values may flow. Verify: The ephemeral value is supplied for the operation but omitted from saved state and plan data. Limitation: Ephemeral values have context restrictions and cannot be inserted into arbitrary persistent expressions.
B:For the workstream in which a small team needs managed Terraform state and remotely executed infrastructure runs with shared visibility rather than running only from laptops, use this action: Create an HCP Terraform workspace and configure an appropriate remote execution workflow with secure credentials. HCP Terraform workspaces coordinate state, variables, remote runs, and collaboration. Verify: Plans and applies run under the HCP workspace and its state versions are centrally accessible to authorized users. Limitation: Workspace configuration and execution permissions must be set before production runs can be trusted.
Incorrect Answers
C:This option addresses a separate requirement: A CI team wants to preserve Terraform debug output to a controlled file for a short-lived investigation. Evidence for that other requirement would be the configured log file contains the expected Terraform diagnostics from the run; neither listed workstream asks for it.
D:This option addresses a separate requirement: A deployment operator needs to replace a single degraded instance deliberately while keeping its resource address. Evidence for that other requirement would be the proposed plan marks that particular resource instance for replacement; neither listed workstream asks for it.
E:This option addresses a separate requirement: A migration changes a backend location but the team must preserve all existing state bindings. Evidence for that other requirement would be the destination backend reflects the prior managed resource addresses and lineage after migration; neither listed workstream asks for it.
Question 336
An infrastructure team faces this specific situation: A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. Which Terraform action most directly satisfies the requirement?
- Pass values through appropriate .tfvars files or documented TF_VAR_name environment variables.
- Use for_each over a suitable set or map to create stable keyed resource instances.
- Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported.
- Index the resource collection by its actual for_each key rather than assuming numeric list positions.
Explanation
Correct Answer
C:Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. Vault centralizes secret management, but Terraform's state-persistence semantics must still be handled explicitly. Verify: Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime. Limitation: A conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen.
Incorrect Answers
A:This is linked to a different situation: A deployment job must supply different nonsecret inputs for each pipeline run without editing source-controlled HCL. There the relevant decision is: Pass values through appropriate .tfvars files or documented TF_VAR_name environment variables. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant decision is: Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. It would therefore not resolve or assess the case as stated.
B:This is linked to a different situation: An application team must create one DNS record per hostname from a stable set of known domain names. There the relevant decision is: Use for_each over a suitable set or map to create stable keyed resource instances. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant decision is: Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A module uses for_each on a map of regions and must output one subnet ID for the us-east-1 instance. There the relevant decision is: Index the resource collection by its actual for_each key rather than assuming numeric list positions. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant decision is: Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. It would therefore not resolve or assess the case as stated.
Question 337
A reviewer is confirming a change for the following use case: A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. The implementation follows this approach: Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. Which observation or acceptance test most directly verifies the intended result?
- Plans show environment-specific port values while preserving the declared type constraint.
- The plan uses the expected values while the shared module source remains unchanged.
- Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime.
- Subsequent plans avoid proposing updates solely because the ignored tag changed outside Terraform.
Explanation
Correct Answer
C:Acceptance evidence: Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime. It validates the proposed action, read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported, because vault centralizes secret management, but Terraform's state-persistence semantics must still be handled explicitly. Remaining limitation: A conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen.
Incorrect Answers
A:This is linked to a different situation: A deployment needs separate port numbers per environment and a documented default for developer sandboxes. There the relevant acceptance is: Plans show environment-specific port values while preserving the declared type constraint. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant acceptance is: Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime. It would therefore not resolve or assess the case as stated.
B:This is linked to a different situation: A deployment job must supply different nonsecret inputs for each pipeline run without editing source-controlled HCL. There the relevant acceptance is: The plan uses the expected values while the shared module source remains unchanged. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant acceptance is: Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A managed resource's tag is updated by an external compliance agent, and Terraform must not revert only that tag on every plan. There the relevant acceptance is: Subsequent plans avoid proposing updates solely because the ignored tag changed outside Terraform. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant acceptance is: Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime. It would therefore not resolve or assess the case as stated.
Question 338
Consider a proposed solution for this requirement: A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. The team plans to do the following: Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. Which limitation or operational caveat must remain in the review?
- dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks.
- A conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen.
- An object type is not interchangeable with any arbitrary map if its declared attributes differ.
- Order-sensitive outputs should not be built from unordered map iteration without intentional sorting.
Explanation
Correct Answer
B:The limitation is a conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen. The proposed change is read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. Validate it by checking version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime. Vault centralizes secret management, but Terraform's state-persistence semantics must still be handled explicitly.
Incorrect Answers
A:This is linked to a different situation: A security group requires multiple repeated ingress blocks derived from a variable collection, and copy-pasting blocks is error-prone. There the relevant limitation is: dynamic can generate normal nested blocks, not arbitrary provider meta-arguments or resource blocks. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant limitation is: A conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A developer defines a subnet inventory in which every subnet has cidr, zone, and public attributes, and needs reliable shape checking. There the relevant limitation is: An object type is not interchangeable with any arbitrary map if its declared attributes differ. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant limitation is: A conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: A module emits an ordered list of three subnet IDs aligned with ordered availability zones and consumers depend on position. There the relevant limitation is: Order-sensitive outputs should not be built from unordered map iteration without intentional sorting. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant limitation is: A conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen. It would therefore not resolve or assess the case as stated.
Question 339
The team is reviewing a Terraform implementation for this case: A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. Which tempting assumption would be specifically incorrect for this proposed implementation?
- Use a list and assume duplicate elements are automatically removed while maintaining indices.
- Assume all values fetched through Vault are automatically omitted from Terraform state.
- Assume prevent_destroy continues to protect an object after the containing resource block is deleted.
- Assume any object named in a data block is subject to resource deletion on destroy.
Explanation
Correct Answer
B:Reject the assumption: Assume all values fetched through Vault are automatically omitted from Terraform state. Instead, read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. Vault centralizes secret management, but Terraform's state-persistence semantics must still be handled explicitly. Acceptance evidence: Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime.
Incorrect Answers
A:This is linked to a different situation: A security allowlist is an unordered set of unique ports and duplicate entries must not affect the configuration. There the relevant misconception is: Use a list and assume duplicate elements are automatically removed while maintaining indices. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant misconception is: Assume all values fetched through Vault are automatically omitted from Terraform state. It would therefore not resolve or assess the case as stated.
C:This is linked to a different situation: A team's database must never be accidentally destroyed by a routine Terraform plan while its resource declaration remains managed. There the relevant misconception is: Assume prevent_destroy continues to protect an object after the containing resource block is deleted. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant misconception is: Assume all values fetched through Vault are automatically omitted from Terraform state. It would therefore not resolve or assess the case as stated.
D:This is linked to a different situation: An engineer sees a data block representing a preexisting DNS zone and wants to delete that DNS zone with terraform destroy. There the relevant misconception is: Assume any object named in a data block is subject to resource deletion on destroy. For the question's actual requirement — A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. — the specifically relevant misconception is: Assume all values fetched through Vault are automatically omitted from Terraform state. It would therefore not resolve or assess the case as stated.
Question 340
A Terraform platform team is coordinating 3 independent decisions. Workstream A: A company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control. and Workstream B: A development team connects one infrastructure repository to an HCP Terraform workspace and expects reviewed commits to trigger plans. and Workstream C: A CI job already has provider plugins cached and wants to reinitialize a checkout safely after an ordinary module change. Select exactly 3 actions, one addressing each distinct workstream.
- Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported.
- Configure the workspace's VCS connection, working directory, and run triggers for the intended branch.
- Use for_each on the module block and reference module.stack["test"].endpoint.
- Select suitable Azure and monitoring providers and declare both systems through one Terraform root module.
- Declare resources through separate compatible providers in one Terraform configuration, with references for dependencies.
- Re-run terraform init and review module/provider resolution within existing constraints.
Explanation
Correct Answers
A:For the workstream in which a company rotates application credentials in Vault and wants Terraform pipelines to avoid checking decrypted secrets into source control, use this action: Read or pass credentials with an approved Vault integration and secure runtime identity, applying ephemeral/write-only protections where supported. Vault centralizes secret management, but Terraform's state-persistence semantics must still be handled explicitly. Verify: Version-controlled HCL contains no hardcoded cleartext credential and the approved secret path is resolvable at runtime. Limitation: A conventional Vault data source may still write returned secrets into state unless a safe mechanism is chosen.
B:For the workstream in which a development team connects one infrastructure repository to an HCP Terraform workspace and expects reviewed commits to trigger plans, use this action: Configure the workspace's VCS connection, working directory, and run triggers for the intended branch. VCS-driven workflows integrate versioned configuration with workspace execution triggers. Verify: A relevant commit produces a workspace run and pull requests can show speculative plans if configured. Limitation: In a monorepo, trigger paths should prevent unrelated folder changes from creating unnecessary runs.
F:For the workstream in which a CI job already has provider plugins cached and wants to reinitialize a checkout safely after an ordinary module change, use this action: Re-run terraform init and review module/provider resolution within existing constraints. Init is designed to be repeatable and does not delete managed state as its purpose. Verify: Initialization completes without destroying infrastructure and updates required module installations. Limitation: Safe reinitialization may still expose provider-version conflicts or backend authentication errors.
Incorrect Answers
C:This action is appropriate instead for a different, unlisted requirement: A module is instantiated for each environment in a map, and the root needs the output for the test environment. It would be checked by: The keyed module instance exposes only the test environment's selected output. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
D:This action is appropriate instead for a different, unlisted requirement: A company uses Azure for application workloads and a SaaS provider for monitoring, and wants to avoid managing two separate IaC languages. It would be checked by: Plan output contains the cloud deployment and monitoring integrations with clear provider ownership. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
E:This action is appropriate instead for a different, unlisted requirement: A logistics firm needs a private data-center virtual machine and a public-cloud DNS record managed from one reviewed release. It would be checked by: A single plan lists the intended private and public resource actions under their respective providers. None of the 3 specified workstreams calls for this action; their correct choices directly solve the identified cases.
HashiCorp Certified: Terraform Associate (004) (Terraform Associate 004) Practice Tests