Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 147


How does Terraform determine dependencies between resources?

Show Answer
Correct Answer: A

Terraform automatically builds a resource graph based on resources, provisioners, special meta-parameters, and the state file, if present. This resource graph allows Terraform to determine the dependencies between resources so that they can be created, updated, or destroyed in the correct order. Terraform constructs this graph by evaluating the implicit relationships defined in the configuration, as well as any explicit dependencies specified by parameters like depends_on.

Discussion

5 comments
Sign in to comment
depal_dhirOption: A
Mar 7, 2023

https://learn.hashicorp.com/tutorials/terraform/dependencies

keiffo2
Mar 6, 2023

A is the correct answer - by way of eliminating the other answers

BereOption: A
Jul 17, 2024

https://developer.hashicorp.com/terraform/tutorials/configuration-language/dependencies Most of the time, Terraform infers dependencies between resources based on the configuration given, so that resources are created and destroyed in the correct order. Occasionally, however, Terraform cannot infer dependencies between different parts of your infrastructure, and you will need to create an explicit dependency with the depends_on argument.

chael88
Jul 29, 2023

Took the exam and passed. There was a similar question like this not listed here on ExamTopics. It goes like this: How does Terraform handle dependencies? A. By using depends_on B. Terraform will automatically handle some resource dependencies I cant remember the other options, but I selected B.

SilentMilliOption: A
Sep 25, 2023

When Terraform evaluates a configuration, it automatically creates a graph of all the resources and their dependencies. Terraform uses this graph to determine the order in which resources need to be created, updated, or destroyed. Terraform looks at resource dependencies based on implicit and explicit relationships between resources, which are defined using properties like count, for_each, depends_on, and others. Terraform can also use the state file to track dependencies between resources and maintain the order of operations during updates