Interview Prep/Terraform/IaC and Terraform Fundamentals

How does Terraform decide the order in which to create and destroy resources?

AdvancedConceptIaC and Terraform Fundamentals
Answer

It builds a directed acyclic graph from references: if aws_instance.web uses aws_subnet.a.id, the subnet is created first. Independent nodes run in parallel (default -parallelism=10). Destroy walks the graph in reverse. Implicit edges come from expressions, explicit ones from depends_on. A circular reference fails with Error: Cycle: ....

All Terraform questions Roadmap: Terraform

More on IaC and Terraform Fundamentals