What is the provider for this resource?
Correct Answer:
D
In the given Terraform configuration snippet: resource "aws_vpc" "main" {
name = "test"
}
The provider for the resource aws_vpc is aws. The provider is specified by the prefix of the resource type. In this case, aws_vpc indicates that the resource type vpc is provided by the aws provider.
References:
✑ Terraform documentation on providers: Terraform Providers
Module version is required to reference a module on the Terraform Module Registry.
Correct Answer:
B
Module version is optional to reference a module on the Terraform Module Registry. If you omit the version constraint, Terraform will automatically use the latest available version of the module
All standard backend types support state locking, and remote operations like plan, apply, and destroy.
Correct Answer:
B
Not all standard backend types support state locking and remote operations like plan, apply, and destroy. For example, the local backend does not support remote operations and state locking. State locking is a feature that ensures that no two users can make changes to the state file at the same time, which is crucial for preventing race conditions. Remote operations allow running Terraform commands on a remote server, which is supported by some backends like remote or consul, but not all.
References:
✑ Terraform documentation on backends: Terraform Backends
✑ Detailed backend support: Terraform Backend Types
You have created a main.tf Terraform configuration consisting of an application server, a database and a load balanced. You ran terraform apply and Terraform created all of the resources successfully.
Now you realize that you do not actually need the load balancer, so you run terraform destroy without any flags. What will happen?
Correct Answer:
C
This is what will happen if you run terraform destroy without any flags, as it will attempt to delete all the resources that are associated with your current working directory or workspace. You can use the -target flag to specify a particular resource that you want to destroy.
What is the Terraform style convention for indenting a nesting level compared to the one above it?
Correct Answer:
B
This is the Terraform style convention for indenting a nesting level compared to the one above it. The other options are not consistent with the Terraform style guide.