TERRAFORM-ASSOCIATE-003 practice question 9 of 30

[Interact with Terraform Modules] Terraform can only manage resource dependencies if you set them explicitly with the depends_on argument.

Full set: 226 questions
Answer options
A: True
B: False
Correct Answer:
[FALSE]
Explanation

The statement is false because Terraform's primary mechanism for managing dependencies is implicit. Terraform automatically builds a dependency graph by parsing the configuration and analyzing the references between resources. For example, if a virtual machine resource configuration references the ID of a virtual network, Terraform understands that the virtual machine depends on the virtual network and will create the network first. The dependson meta-argument is an override mechanism used only to create explicit dependencies for cases where a dependency is not visible to Terraform through direct resource references.

Why Incorrect

The statement "True" is incorrect because it completely ignores Terraform's core feature of implicit dependency resolution. Relying solely on dependson for all dependencies would be cumbersome and is contrary to Terraform's design, which aims to automate as much of the dependency management as possible.

References

1. HashiCorp Terraform Documentation, "Resource Dependencies": "When one resource refers to another, it creates an implicit dependency. Terraform uses this dependency information to determine the correct order in which to create the different resources... The dependson argument is accepted by any resource or module block and accepts a list of references to other resources or modules in the same calling module. This creates an explicit dependency."

2. HashiCorp Terraform Documentation, "The dependson Meta-Argument": "Use the dependson meta-argument to handle hidden resource or module dependencies that Terraform cannot automatically infer. You only need to explicitly specify a dependency when a resource relies on some other resource's behavior but does not access any of that resource's data in its arguments."

3. HashiCorp Learn, "Manage Resource Dependencies": "Terraform analyzes your configuration to automatically find dependencies between your resources. This creates an implicit ordering for resource creation and destruction... For dependencies that Terraform cannot infer, you can use the dependson meta-argument to create an explicit dependency."

Scroll to Top