A dependency is a prerequisite relationship: one infrastructure action or object must exist before another can proceed. Terraform uses these relationships to determine the order in which it launches and modifies managed resources. section 5.2
Terraform represents dependencies with a directed acyclic graph. Resources form nodes, while directed connections express relationships between them. Attribute and parameter references create these links, and Terraform state acts as a snapshot of the graph. Because the graph is acyclic, a circular dependency causes Terraform to fail rather than choose an order. section 5.2 section 5.1.1
Dependencies also organize repeatable command workflows:
- Make allows one target to require other targets before it runs, so a grouping target can invoke several tasks together. section 7.2.2
- A target such as chores can depend on format and document, causing formatting and documentation commands to run through one entry point. section 7.2.2
- Keep dependency relationships acyclic; circular relationships prevent Terraform from producing a valid execution order. section 5.2
Grouping formatting and documentation
A Makefile can define `chores: format document`, then define `format` to run `terraform fmt` and `document` to run `terraform-docs`. Running `make chores` uses the declared dependencies to invoke both tasks from one command. section 7.2.2
Listing 7.3 makefile syntax
.PHONY: target #1
target: #2
command #3
Use the compact Makefile listing to inspect the syntax of a target and its command before adding dependency targets. section 7.2.2


























