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 type of block is used to construct a collection of nested configuration blocks?
- A . for_each
- B . repeated
- C . nesting
- D . dynamic
D
Explanation:
https://www.terraform.io/language/expressions/dynamic-blocks
How is terraform import run?
- A . As a part of terraform init
- B . As a part of terraform plan
- C . As a part of terraform refresh
- D . By an explicit call
- E . All of the above
D
Explanation:
"The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of Terraform will also generate configuration. Because of this, prior to running terraform import it is necessary to write manually a resource configuration block for the resource, to which the imported object will be mapped. While this may seem tedious, it still gives Terraform users an avenue for importing existing resources." https://www.terraform.io/cli/import/usage
When using Terraform to deploy resources into Azure, which scenarios are true regarding state files? (Choose two.)
- A . When a change is made to the resources via the Azure Cloud Console, the changes are recorded in a new state file
- B . When a change is made to the resources via the Azure Cloud Console, Terraform will update the state file to reflect them during the next plan or apply
- C . When a change is made to the resources via the Azure Cloud Console, the current state file will not be updated
- D . When a change is made to the resources via the Azure Cloud Console, the changes are recorded in the current state file
When using a module block to reference a module stored on the public Terraform Module Registry such as:
How do you specify version 1.0.0?
- A . Modules stored on the public Terraform Module Registry do not support versioning
- B . Append ?ref=v1.0.0 argument to the source path
- C . Add version = "1.0.0" attribute to module block
- D . Nothing C modules stored on the public Terraform Module Registry always default to version 1.0.0
C
Explanation:
Version
When using modules installed from a module registry, we recommend explicitly constraining the acceptable version numbers to avoid unexpected or unwanted changes.
Use the version argument in the module block to specify versions:
module "consul" {
source = "hashicorp/consul/aws"
version = "0.0.5"
servers = 3
}
Reference: https://www.terraform.io/docs/language/modules/sources.html
A Terraform provider is not responsible for:
- A . Understanding API interactions with some service
- B . Provisioning infrastructure in multiple clouds
- C . Exposing resources and data sources based on an API
- D . Managing actions to take based on resource differences
B
Explanation:
https://www.terraform.io/language/providers
Which of the following is allowed as a Terraform variable name?
- A . count
- B . name
- C . source
- D . version
B
Explanation:
"The name of a variable can be any valid identifier except the following: source, version, providers, count, for_each, lifecycle, depends_on, locals." https://www.terraform.io/language/values/variables
You have never used Terraform before and would like to test it out using a shared team account for a cloud provider. The shared team account already contains 15 virtual machines (VM). You develop a Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully.
What should you do to delete the newly-created VM with Terraform?
- A . The Terraform state file contains all 16 VMs in the team account. Execute terraform destroy and select the newly-created VM.
- B . The Terraform state file only contains the one new VM. Execute terraform destroy.
- C . Delete the Terraform state file and execute Terraform apply.
- D . Delete the VM using the cloud provider console and terraform apply to apply the changes to the Terraform state file.
B
Explanation:
You develop a Terraform configuration containing one VM, perform terraform apply, and see that your VM was created successfully. read the question carefully "Terraform configuration containing one VM, perform terraform apply" so only one VM is in state file.
How can terraform plan aid in the development process?
- A . Validates your expectations against the execution plan without permanently modifying state
- B . Initializes your working directory containing your Terraform configuration files
- C . Formats your Terraform configuration files
- D . Reconciles Terraform’s state against deployed resources and permanently modifies state using the current status of deployed resources
A
Explanation:
"The terraform plan command creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure. By default, when Terraform creates a plan it:
Reads the current state of any already-existing remote objects to make sure that the Terraform state is up-to-date.
Compares the current configuration to the prior state and noting any differences. Proposes a set of change actions that should, if applied, make the remote objects match the configuration."
"The plan command alone will not actually carry out the proposed changes, and so you can use this command to check whether the proposed changes match what you expected before you apply the changes or share your changes with your team for broader review.
If Terraform detects that no changes are needed to resource instances or to root module output values, terraform plan will report that no actions need to be taken."
https://www.terraform.io/cli/commands/plan
Which backend does the Terraform CLI use by default?
- A . Terraform Cloud
- B . Consul
- C . Remote
- D . Local
D
Explanation:
"By default, Terraform implicitly uses a backend called local to store state as a local file on disk. Every other backend stores state in a remote service of some kind, which allows multiple people to access it. Accessing state in a remote service generally requires some kind of access credentials, since state data contains extremely sensitive information." https://www.terraform.io/language/settings/backends
When does terraform apply reflect changes in the cloud environment?
- A . Immediately
- B . However long it takes the resource provider to fulfill the request
- C . After updating the state file
- D . Based on the value provided to the -refresh command line argument
- E . None of the above