Implicit Resource Dependencies
Explore the concept of implicit resource dependencies within Terraform’s remote resource management. Understand how Terraform automatically tracks dependencies between resources like VPCs and subnets, and learn to use the -target flag to plan or destroy specific resources. This lesson helps you manage the order and dependencies of infrastructure components reliably without relying on declared resource order.
We'll cover the following...
Dependencies
The dependencies are the bane of any infrastructure manager’s life. If we switch off the Virtual Machine (VM), who will complain? What about the load balancer?
Stories of switching off servers to see who complains as a way of managing unknown dependencies are incredibly common in the IT industry.
Terraform can help manage that problem by codifying and tracking resource dependencies. However, it’s important to remember that it does not do so by magic and that our application dependencies may still need to be mapped out by whoever’s in charge of them.
Implicit dependency
Initially, we need to set up our credentials. Then, we create a new directory with a Terraform module.
We also create a Terraform module with a defined AWS provider.
Then we add two resources to the dependencies.tf file. The first is ...