HashiCorp Certified: Terraform Associate — Question 332
How does Terraform determine dependencies between resources?
Answer options
- A. Terraform automatically builds a resource graph based on resources, provisioners, special meta-parameters, and the state file, if present.
- B. Terraform requires all dependencies between resources to be specified using the depends_on parameter
- C. Terraform requires resources in a configuration to be listed in the order they will be created to determine dependencies
- D. Terraform requires resource dependencies to be defined as modules and sourced in order
Correct answer: A
Explanation
The correct answer is A because Terraform constructs a resource graph automatically by analyzing the resources and their characteristics, along with the state file if available. Options B, C, and D are incorrect as they suggest manual specification of dependencies, which contradicts Terraform's automated dependency resolution process.