HashiCorp TA-002-P Exam
HashiCorp Certified: Terraform Associate (Page 16 )

Updated On: 7-Feb-2026

Your security team scanned some Terraform workspaces and found secrets stored in a plaintext in state files. How can you protect sensitive data stored in Terraform state files?

  1. Delete the state file every time you run Terraform
  2. Store the state in an encrypted backend
  3. Edit your state file to scrub out the sensitive data
  4. Always store your secrets in a secrets.tfvars file.

Answer(s): B



In contrast to Terraform Open Source, when working with Terraform Enterprise and Cloud Workspaces, conceptually you could think about them as completely separate working directories.

  1. True
  2. False

Answer(s): A

Explanation:

"When run locally, Terraform manages each collection of infrastructure with a persistent working directory, which contains a configuration, state data, and variables. Since Terraform CLI uses content from the directory it runs in, you can organize infrastructure resources into meaningful groups by keeping their configurations in separate directories.


Reference:

https://www.terraform.io/cloud-docs/workspaces



You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (files). You need to enable debug messages to find this out.
Which of the following would achieve this?

  1. Set the environment variable TF_LOG=TRACE
  2. Set verbose logging for each provider in your Terraform configuration
  3. Set the environment variable TF_VAR_log=TRACE
  4. Set the environment variable TF_LOG_PATH

Answer(s): A

Explanation:

Although this will only output to stderr and if you need to review log file you will need to include TF_LOG_PATH=pathtofile


Reference:

https://www.terraform.io/internals/debugging



How is terraform import run?

  1. As a part of terraform init
  2. As a part of terraform plan
  3. As a part of terraform refresh
  4. By an explicit call
  5. All of the above

Answer(s): D

Explanation:

"The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of Terraform will also generate configuration. Because of this, prior to running terraform import it is necessary to write manually a resource configuration block for the resource, to which the imported object will be mapped. While this may seem tedious, it still gives Terraform users an avenue for importing existing resources."


Reference:

https://www.terraform.io/cli/import/usage



You have a simple Terraform configuration containing one virtual machine (VM) in a cloud provider. You run terraform apply and the VM is created successfully.
What will happen if you delete the VM using the cloud provider console, and run terraform apply again without changing any Terraform code?

  1. Terraform will remove the VM from state file
  2. Terraform will report an error
  3. Terraform will not make any changes
  4. Terraform will recreate the VM

Answer(s): D






Post your Comments and Discuss HashiCorp TA-002-P exam prep with other Community members:

Join the TA-002-P Discussion