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 12,2025.
- Exam Code: TA-002-P
- Exam Name: HashiCorp Certified: Terraform Associate
- Certification Provider: HashiCorp
- Latest update: Jan 12,2025
When you initialize Terraform, where does it cache modules from the public Terraform Module Registry?
- A . On disk in the /tmp directory
- B . In memory
- C . On disk in the .terraform sub-directory
- D . They are not cached
C
Explanation:
"A hidden .terraform directory, which Terraform uses to manage cached provider plugins and modules, record which workspace is currently active, and record the last known backend configuration in case it needs to migrate state on the next run. This directory is automatically managed by Terraform, and is created during initialization." https://www.terraform.io/cli/init
A terraform apply can not _________ infrastructure.
- A . change
- B . destroy
- C . provision
- D . import
D
Explanation:
https://www.educative.io/answers/what-is-the-command-to-destroy-infrastructure-in-terraform
What information does the public Terraform Module Registry automatically expose about published modules?
- A . Required input variables
- B . Optional inputs variables and default values
- C . Outputs
- D . All of the above
- E . None of the above
D
Explanation:
https://www.terraform.io/registry/modules/publish
"The registry extracts information about the module from the module’s source. The module name, provider, documentation, inputs/outputs, and dependencies are all parsed and available via the UI or API, as well as the same information for any submodules or examples in the module’s source repository."
Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.
- A . True
- B . False
A
Explanation:
"Use the depends_on meta-argument to handle hidden resource or module dependencies that Terraform cannot automatically infer. You only need to explicitly specify a dependency when a resource or module relies on another resource’s behavior but does not access any of that resource’s data in its arguments."
https://www.terraform.io/language/meta-arguments/depends_on
When running the command terraform taint against a managed resource you want to force recreation upon, Terraform will immediately destroy and recreate the resource.
- A . True
- B . False
B
Explanation:
"The terraform taint command informs Terraform that a particular object has become degraded or damaged. Terraform represents this by marking the object as "tainted" in the Terraform state, and Terraform will propose to replace it in the next plan you create." FYI – This command is deprecated. For Terraform v0.15.2 and later, we recommend using the -replace option with terraform apply instead. For Terraform v0.15.2 and later, we recommend using the -replace option with terraform apply to force Terraform to replace an object even though there are no configuration changes that would require it. https://www.terraform.io/cli/commands/taint
How is the Terraform remote backend different than other state backends such as S3, Consul, etc.?
- A . It can execute Terraform runs on dedicated infrastructure on premises or in Terraform Cloud
- B . It doesn’t show the output of a terraform apply locally
- C . It is only available to paying customers
- D . All of the above
A
Explanation:
Backends define where Terraform’s state snapshots are stored. A given Terraform configuration can either specify a backend, integrate with Terraform Cloud, or do neither and default to storing state locally.
If you and your team are using Terraform to manage meaningful infrastructure, we recommend using the remote backend with Terraform Cloud or Terraform Enterprise.
Reference: https://www.terraform.io/docs/language/settings/backends/index.html
You need to deploy resources into two different cloud regions in the same Terraform configuration.
To do that, you declare multiple provider configurations as follows:
What meta-argument do you need to configure in a resource block to deploy the resource to the “us-west-2” AWS region?
- A . alias = west
- B . provider = west
- C . provider = aws.west
- D . alias = aws.west
C
Explanation:
https://www.terraform.io/language/providers/configuration
Where in your Terraform configuration do you specify a state backend?
- A . The terraform block
- B . The resource block
- C . The provider block
- D . The datasource block
A
Explanation:
Backends are configured with a nested backend block within the top-level terraform block.
Reference:
https://www.terraform.io/docs/language/settings/backends/configuration.html
https://www.terraform.io/language/settings/backends/configuration#using-a-backend-block
Which of the following is not a valid Terraform collection type?
- A . list
- B . map
- C . tree
- D . set
C
Explanation:
https://www.terraform.io/language/expressions/type-constraints#collection-types
A Terraform provisioner must be nested inside a resource configuration block.
- A . True
- B . False
A
Explanation:
Most provisioners require access to the remote resource via SSH or WinRM, and expect a nested connection block with details about how to connect.
Reference: https://www.terraform.io/docs/language/resources/provisioners/connection.html