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
If a module declares a variable with a default, that variable must also be defined within the module.
- A . True
- B . False
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?
- A . Delete the state file every time you run Terraform
- B . Store the state in an encrypted backend
- C . Edit your state file to scrub out the sensitive data
- D . Always store your secrets in a secrets.tfvars file.
What does the default "local" Terraform backend store?
- A . tfplan files
- B . Terraform binary
- C . Provider plugins
- D . State file
D
Explanation:
The local backend stores state on the local filesystem, locks that state using system APIs, and performs operations locally.
Reference: https://www.terraform.io/docs/language/settings/backends/local.html
What is the name assigned by Terraform to reference this resource?
- A . dev
- B . azurerm_resource_group
- C . azurerm
- D . test
You have declared an input variable called environment in your parent module.
What must you do to pass the value to a child module in the configuration?
- A . Add node_count = var.node_count
- B . Declare the variable in a terraform.tfvars file
- C . Declare a node_count input variable for child module
- D . Nothing, child modules inherit variables of parent module
C
Explanation:
"That module may call other modules and connect them together by passing output values from one to input values of another." https://www.terraform.io/language/modules/develop
You have declared a variable called var.list which is a list of objects that all have an attribute id.
Which options will produce a list of the IDs? (Choose two.)
- A . { for o in var.list: o => o.id }
- B . var.list[*].id
- C . [ var.list[*].id ]
- D . [ for o in var.list: o.id ]
B,D
Explanation:
https://www.terraform.io/language/expressions/splat
A splat expression provides a more concise way to express a common operation that could otherwise be performed with a for expression.
Which of these options is the most secure place to store secrets foe connecting to a Terraform remote backend?
- A . Defined in Environment variables
- B . Inside the backend block within the Terraform configuration
- C . Defined in a connection configuration outside of Terraform
- D . None of above
A
Explanation:
https://www.terraform.io/language/settings/backends/configuration#credentials-and-sensitive-data
Warning: We recommend using environment variables to supply credentials and other sensitive data. If you use -backend-config or hardcode these values directly in your configuration, Terraform will include these values in both the .terraform subdirectory and in plan files. This can leak sensitive credentials.
Which argument(s) is (are) required when declaring a Terraform variable?
- A . type
- B . default
- C . description
- D . All of the above
- E . None of the above
B
Explanation:
The variable declaration can also include a default argument.
Reference: https://www.terraform.io/docs/language/values/variables.html
If writing Terraform code that adheres to the Terraform style conventions, how would you properly indent each nesting level compared to the one above it?
- A . With four spaces
- B . With a tab
- C . With three spaces
- D . With two spaces
D
Explanation:
https://www.terraform.io/language/syntax/style#style-conventions
Terraform can import modules from a number of sources C which of the following is not a valid source?
- A . FTP server
- B . GitHub repository
- C . Local path
- D . Terraform Module Registry
A
Explanation:
https://www.terraform.io/language/modules/sources