HashiCorp VA-002-P Exam
HashiCorp Certified: Vault Associate (Page 5 )

Updated On: 30-Jan-2026

What happens when a terraform plan is executed?

  1. the backend is initialized and the working directory is prepped
  2. creates an execution plan and determines what changes are required to achieve the desired state in the configuration files.
  3. applies the changes required in the target infrastructure in order to reach the desired configuration
  4. reconciles the state Terraform knows about with the real-world infrastructure

Answer(s): B

Explanation:

The terraform plan command is used to create an execution plan. Terraform performs a refresh, unless explicitly disabled, and then determines what actions are necessary to achieve the desired state specified in the configuration files.
After a plan has been run, it can be executed by running a terraform apply



Which of the following Terraform files should be ignored by Git when committing code to a repo? (select two)

  1. output.tf
  2. terraform.tfstate
  3. terraform.tfvars
  4. variables.tf

Answer(s): B,C

Explanation:

The .gitignore file should be configured to ignore Terraform files that either contain sensitive data or aren't required to save.
The terraform.tfstate file contains the terraform state of a specific environment and doesn't need to be preserved in a repo. The terraform.tfvars file may contain sensitive data, such as passwords or IP addresses of an environment that you may not want to share with others.



You want to use terraform import to start managing infrastructure that was not originally provisioned through infrastructure as code. Before you can import the resource's current state, what must you do in order to prepare to manage these resources using Terraform?

  1. run terraform refresh to ensure that the state file has the latest information for existing resources.
  2. update the configuration file to include the new resources
  3. modify the Terraform state file to add the new resources
  4. shut down or stop using the resources being imported so no changes are inadvertently missed

Answer(s): B

Explanation:

The current implementation of Terraform import can only import resources into the state. It does not generate a configuration. Because of this, and prior to running terraform import, it is necessary to manually write a resource configuration block for the resource to which the imported object will be mapped.
First, add the resources to the configuration file:
resource "aws_instance" "example" {
# ...instance configuration...
}
Then run the following command:
$ terraform import aws_instance.example i-abcd1234



By default, where does Terraform store its state file?

  1. shared directory
  2. current working directory
  3. Amazon S3 bucket
  4. remotely using Terraform Cloud

Answer(s): B

Explanation:

By default, the state file is stored in a local file named "terraform.tfstate", but it can also be stored
remotely, which works better in a team environment.



Why is it a good idea to declare the required version of a provider in a Terraform configuration file?
1. terraform {
2. required_providers {
3. aws = "~> 1.0"
4. }
5. }

  1. to remove older versions of the provider
  2. to ensure that the provider version matches the version of Terraform you are using
  3. providers are released on a separate schedule from Terraform itself; therefore a newer version could introduce breaking changes
  4. to match the version number of your application being deployed via Terraform

Answer(s): C

Explanation:

Providers are plugins released on a separate rhythm from Terraform itself, and so they have their own version numbers. For production use, you should constrain the acceptable provider version via configuration. This helps to ensure that new versions with potentially breaking changes will not be automatically installed by terraform init in the future.



Viewing page 5 of 41
Viewing questions 21 - 25 out of 200 questions



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

Join the VA-002-P Discussion