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
What command should you run to display all workspaces for the current configuration?
- A . terraform workspace
- B . terraform workspace show
- C . terraform workspace list
- D . terraform show workspace
C
Explanation:
terraform workspace list
The command will list all existing workspaces.
Reference: https://www.terraform.io/docs/cli/commands/workspace/list.html
Terraform and Terraform providers must use the same major version number in a single configuration.
- A . True
- B . False
B
Explanation:
https://www.terraform.io/language/expressions/version-constraints#terraform-core-and-provider-versions
Terraform requires the Go runtime as a prerequisite for installation.
- A . True
- B . False
B
Explanation:
https://www.terraform.io/plugin/sdkv2/guides/v1-upgrade-guide and https://www.terraform.io/plugin/sdkv2/guides/v2-upgrade-guide
Terraform validate reports syntax check errors from which of the following scenarios?
- A . Code contains tabs indentation instead of spaces
- B . There is missing value for a variable
- C . The state files does not match the current infrastructure
- D . None of the above
B
Explanation:
The terraform validate command is used to validate the syntax of the terraform files. Terraform performs a syntax check on all the terraform files in the directory, and will display an error if any of the files doesn’t validate. This command does not check formatting (e.g. tabs vs spaces, newlines, comments etc.). The following can be reported: invalid HCL syntax (e.g. missing trailing quote or equal sign) invalid HCL references (e.g. variable name or attribute which doesn’t exist) same provider declared multiple times same module declared multiple times same resource declared multiple times invalid module name interpolation used in places where it’s unsupported (e.g. variable, depends_on, module.source, provider) missing value for a variable (none of -var foo=… flag, -var-file=foo.vars flag, TF_VAR_foo environment variable, terraform.tfvars, or default value in the configuration) https://www.typeerror.org/docs/terraform/commands/validate https://learning-ocean.com/tutorials/terraform/terraform-validate
Terraform provisioners can be added to any resource block.
- A . True
- B . False
A
Explanation:
https://www.phillipsj.net/posts/introduction-to-terraform-provisioners/
As you continue learning about Terraform, you will start hearing about provisioners.
Terraform provisioners can be created on any resource and provide a way to execute actions on local or remote machines.
https://www.terraform.io/language/resources/provisioners/local-exec
You want to know from which paths Terraform is loading providers referenced in your Terraform configuration (files). You need to enable debug messages to find this out.
Which of the following would achieve this?
- A . Set the environment variable TF_LOG=TRACE
- B . Set verbose logging for each provider in your Terraform configuration
- C . Set the environment variable TF_VAR_log=TRACE
- D . Set the environment variable TF_LOG_PATH
A
Explanation:
Although this will only output to stderr and if you need to review log file you will need to include TF_LOG_PATH=pathtofile https://www.terraform.io/internals/debugging
How can you trigger a run in a Terraform Cloud workspace that is connected to a Version Control System (VCS) repository?
- A . Only Terraform Cloud organization owners can set workspace variables on VCS connected workspaces
- B . Commit a change to the VCS working directory and branch that the Terraform Cloud workspace is connected to
- C . Only members of a VCS organization can open a pull request against repositories that are connected to Terraform Cloud workspaces
- D . Only Terraform Cloud organization owners can approve plans in VCS connected workspaces
B
Explanation:
"In a workspace linked to a VCS repository, runs start automatically when you merge or commit changes to version control.
A workspace is linked to one branch of a VCS repository and ignores changes to other branches. You can specify which files and directories within your repository trigger runs. "
https://www.terraform.io/cloud-docs/run/ui#automatically-starting-runs
Examine the following Terraform configuration, which uses the data source for an AWS AMI.
What value should you enter for the ami argument in the AWS instance resource?
- A . aws_ami.ubuntu
- B . data.aws_ami.ubuntu
- C . data.aws_ami.ubuntu.id
- D . aws_ami.ubuntu.id
C
Explanation:
resource "aws_instance" "web" {
ami= data.aws_ami.ubuntu.id
Reference:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
The terraform.tfstate file always matches your currently built infrastructure.
- A . True
- B . False
B
Explanation:
Reference: https://www.terraform.io/docs/language/state/index.html
What is not processed when running a terraform refresh?
- A . State file
- B . Configuration file
- C . Credentials
- D . Cloud provider
B
Explanation:
"The terraform refresh command reads the current settings from all managed remote objects and updates the Terraform state to match."