HashiCorp TA-002-P HashiCorp Certified: Terraform Associate Online Training
HashiCorp TA-002-P Online Training
The questions for TA-002-P were last updated at Jan 13,2025.
- Exam Code: TA-002-P
- Exam Name: HashiCorp Certified: Terraform Associate
- Certification Provider: HashiCorp
- Latest update: Jan 13,2025
A provider configuration block is required in every Terraform configuration.
Example:
- A . True
- B . False
B
Explanation:
Unlike many other objects in the Terraform language, a provider block may be omitted if its contents would otherwise be empty. Terraform assumes an empty default configuration for any provider that is not explicitly configured.
https://www.terraform.io/language/providers/configuration
Your DevOps team is currently using the local backend for your Terraform configuration. You would like to move to a remote backend to begin storing the state file in a central location.
Which of the following backends would not work?
- A . Amazon S3
- B . Artifactory
- C . Git
- D . Terraform Cloud
C
Explanation:
https://www.terraform.io/cdktf/concepts/remote-backends https://docs.gitlab.com/ee/user/infrastructure/iac/terraform_state.html
What features stops multiple admins from changing the Terraform state at the same time?
- A . Version control
- B . Backend types
- C . Provider constraints
- D . State locking
D
Explanation:
Somewhat ambiguous question however the key phrase is "feature". You need a remote backend first with a State Locking feature available to avoid this scenario.
https://blog.gruntwork.io/how-to-manage-terraform-state-28f5697e68fa
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?
- A . Terraform will remove the VM from state file
- B . Terraform will report an error
- C . Terraform will not make any changes
- D . Terraform will recreate the VM
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.
- A . True
- B . False
A
Explanation:
https://www.terraform.io/cloud-docs/workspaces
"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.
You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead.
What are the two things you must do to achieve this? (Choose two.)
- A . Provision new VMs using Terraform with the same VM names
- B . Use the terraform import command for the existing VMs
- C . Write Terraform configuration for the existing VMs
- D . Run the terraform import-gcp command
B,C
Explanation:
You should create the equivalent configuration first, and then run import to load it on the state file.
Which of the following is not a key principle of infrastructure as code?
- A . Versioned infrastructure
- B . Golden images
- C . Idempotence
- D . Self-describing infrastructure
B
Explanation:
Reference: https://docs.microsoft.com/en-us/azure/devops/learn/what-is-infrastructure-as-code#:~:text=Idempotence%20is%20a%20principle%20of,of%20the%20environment’s%20 starting%20state.
Which of the following is not true of Terraform providers?
- A . Providers can be written by individuals
- B . Providers can be maintained by a community of users
- C . Some providers are maintained by HashiCorp
- D . Major cloud vendors and non-cloud vendors can write, maintain, or collaborate on
Terraform providers - E . None of the above
E
Explanation:
https://registry.terraform.io/providers/hashicorp/google/latest – This provider is
collaboratively maintained by the Google Terraform Team at Google and the Terraform
team at HashiCorp
https://www.terraform.io/language/providers
How would you reference the "name" value of the second instance of this fictitious resource?
- A . element(aws_instance.web, 2)
- B . aws_instance.web[1].name
- C . aws_instance.web[1]
- D . aws_instance.web[2].name
- E . aws_instance.web.*.name
B
Explanation:
https://www.terraform.io/language/meta-arguments/count#referring-to-instances
Reference: https://www.terraform.io/docs/configuration-0-11/interpolation.html
terraform init initializes a sample main.tf file in the current directory.
- A . True
- B . False
B
Explanation:
Reference: https://www.terraform.io/docs/cli/commands/init.html