11. A child module can always access variables declared in its parent module.
A. True
B. False
Answer
B
12. You are writing a child Terraform module that provisions an AWS instance. You want to reference the IP address returned by the child module in the root configuration. You name the instance resource “main”.
Which of these is the correct way to define the output value?
A.
output "instance_ip_addr" {
value = aws_instance.main.private_ip
}
B.
output "aws_instance.instance_ip_addr" {
value = ${main.private_ip}
}
C.
output "instance_ip_addr" {
return aws_instance.main.private_ip
}
D.
output "aws_instance.instance_ip_addr" {
return aws_instance.main.private_ip
}
Answer
A
13. When does Sentinel enforce policy logic during a Terraform Cloud run?
A. Before the plan phase
B. During the plan phase
C. Before the apply phase
D. After the apply phase
Answer
C
14. What is terraform refresh-only intended to detect?
A. Empty state files
B. Corrupt state files
C. Terraform configuration code changes
D. State file drift
Answer
D
15. You should run terraform fmt to rewrite all Terraform configurations within the current working directory to conform to Terraform-style conventions.
A. True
B. False
Answer
A
16. Why would you use the -replace flag for terraform apply?
A. You want to force Terraform to destroy a resource on the next apply
B. You want Terraform to ignore a resource on the next apply
C. You want to force Terraform to destroy and recreate a resource on the next apply
D. You want Terraform to destroy all the infrastructure in your workspace
Answer
C
17. You can configure Terraform to log to a file using the TF_LOG environment variable.
A. True
B. False
Answer
B
18. When does Terraform create the .terraform.lock.hcl file?
A. After your first terraform plan
B. After your first terraform apply
C. After your first terraform init
D. Whenever you enable state locking
Answer
C
19. You have been working on a Cloud provider account that is shared with other team members. You previously used Terraform to create a load balancer that is listening on port 80. After some application changes, you updated the Terraform code to change the port to 443.
You run terraform plan and see that the execution plan shows the port changing from 80 to 443 like you intended, and step away to grab some coffee.
In the meantime, another team member manually changes the load balancer port to 443 through the Cloud provider console before you get back to your desk.
What will happen when you terraform apply upon returning to your desk?
A. Terraform will fail with an error because the state file is no longer accurate.
B. Terraform will change the load balancer port to 80, and then change it back to 443.
C. Terraform will not make any changes to the Load Balancer and will update the state file to reflect any changes made.
D. Terraform will recreate the load balancer.
Answer
C
20. Which of the following is not an action performed by terraform init?
A. Create template configuration files
B. Initialize a configured backend
C. Retrieve the source code for all referenced modules
D. Load required provider plugins
Answer
A