- (Exam Topic 3)
A user has created three workspaces using the command line - prod, dev, and test. The user wants to create a fourth workspace named stage. Which command will the user execute to accomplish this?
Correct Answer:
A
The terraform workspace new command is used to create a new workspace. https://www.terraform.io/docs/commands/workspace/new.html
- (Exam Topic 4)
What does terraform destroy do?
Correct Answer:
A
The terraform destroy command terminates resources managed by your Terraform project. This command is the inverse of terraform apply in that it terminates all the resources specified in your Terraform state. It does not destroy resources running elsewhere that are not managed by the current Terraform project. https://learn.hashicorp.com/tutorials/terraform/aws-destroy
- (Exam Topic 1)
When you initialize Terraform, where does it cache modules from the public Terraform Module Registry?
Correct Answer:
C
"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
- (Exam Topic 3)
Refer to the following terraform variable definition
variable "track_tag" { type = list default = ["data_ec2","integration_ec2","digital_ec2"]} track_tag = { Name = element(var.track_tag,count.index)}
If count.index is set to 2, which of the following values will be assigned to the name attribute of track_tag variable?
Correct Answer:
B
- (Exam Topic 1)
How would you reference the "name" value of the second instance of this fictitious resource?
Correct Answer:
B
https://www.terraform.io/language/meta-arguments/count#referring-to-instances Reference: https://www.terraform.io/docs/configuration-0-11/interpolation.html