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
CORRECT TEXT
FILL BLANK
What is the name of the default file where Terraform stores the state?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
"This state is stored by default in a local file named "terraform.tfstate", but it can also be stored remotely, which works better in a team environment." https://www.terraform.io/language/state
Which of these is the best practice to protect sensitive values in state files?
- A . Blockchain
- B . Secure Sockets Layer (SSL)
- C . Enhanced remote backends
- D . Signed Terraform providers
C
Explanation:
Use of remote backends and especially the availability of Terraform Cloud, there are now a variety of backends that will encrypt state at rest and will not store the state in cleartext on machines running.
Reference: https://www.terraform.io/docs/extend/best-practices/sensitive-state.html
You have deployed a new webapp with a public IP address on a clod provider. However, you did not create any outputs for your code.
What is the best method to quickly find the IP address of the resource you deployed?
- A . Run terraform output ip_address to view the result
- B . In a new folder, use the terraform_remote_state data source to load in the state file, then write an output for each resource that you find the state file
- C . Run terraform state list to find the name of the resource, then terraform state show to find the attributes including public IP address
- D . Run terraform destroy then terraform apply and look for the IP address in stdout
C
Explanation:
https://www.terraform.io/cli/commands/state/show
CORRECT TEXT
FILL BLANK
Which flag would you add to terraform plan to save the execution plan to a file?
Type your answer in the field provided. The text field is not case-sensitive and all variations of the correct answer are accepted.
"You can use the optional -out=FILE option to save the generated plan to a file on disk, which you can later execute by passing the file to terraform apply as an extra argument. This two-step workflow is primarily intended for when running Terraform in automation. If you run terraform plan without the -out=FILE option then it will create a speculative plan, which is a description of the effect of the plan but without any intent to actually apply it." https://www.terraform.io/cli/commands/plan
You have multiple team members collaborating on infrastructure as code (IaC) using Terraform, and want to apply formatting standards for readability.
How can you format Terraform HCL (HashiCorp Configuration Language) code according to standard Terraform style convention?
- A . Run the terraform fmt command during the code linting phase of your CI/CD process
- B . Designate one person in each team to review and format everyone’s code
- C . Manually apply two spaces indentation and align equal sign "=" characters in every Terraform file (*.tf)
- D . Write a shell script to transform Terraform files using tools such as AWK, Python, and sed
A
Explanation:
https://www.terraform.io/cli/commands/fmt
You would like to reuse the same Terraform configuration for your development and production environments with a different state file for each.
Which command would you use?
- A . terraform import
- B . terraform workspace
- C . terraform state
- D . terraform init
B
Explanation:
https://www.terraform.io/language/state/workspaces#when-to-use-multiple-workspaces
Which of the following is not an action performed by terraform init?
- A . Create a sample main.tf file
- B . Initialize a configured backend
- C . Retrieve the source code for all referenced modules
- D . Load required provider plugins
What is the name assigned by Terraform to reference this resource?
- A . compute_instance
- B . main
- C . google
- D . test
If a module uses a local variable, you can expose that value with a terraform output.
- A . True
- B . False
A
Explanation:
Output values are like function return values.
Reference: https://www.terraform.io/docs/language/values/locals.html https://www.terraform.io/docs/language/values/outputs.html
Which provisioner invokes a process on the resource created by Terraform?
- A . remote-exec
- B . null-exec
- C . local-exec
- D . file
A
Explanation:
"The local-exec provisioner invokes a local executable after a resource is created. This invokes a process on the machine running Terraform, not on the resource." https://www.terraform.io/language/resources/provisioners/local-exec
"The remote-exec provisioner invokes a script on a remote resource after it is created." https://www.terraform.io/language/resources/provisioners/remote-exec