Generating the dependency graph
One of the interesting features of Terraform is the ability to generate a dependency graph of the resource dependencies declared in the Terraform configuration.
The visualization of the dependency graph is important to understand the dependencies of Terraform resources and the Terraform operations order.
In this recipe, we will see how to generate and visualize this dependency graph.
Getting ready
For this recipe, we need to use a third-party drawing generation tool called Graphviz, which is available for download at https://graphviz.gitlab.io/download/. You will need to download and install the package corresponding to your OS.
As an example, we will take the Terraform configuration available at https://github.com/PacktPublishing/Terraform-Cookbook-Second-Edition/tree/main/CHAP06/sampleApp.
How to do it…
To generate the dependency graph, perform the following steps:
- Inside the folder that contains the Terraform...