Implicit dependency
resource "terraform_data" "network" { input = "net-a" }
resource "terraform_data" "app" {
input = "using-${terraform_data.network.output}"
}- The reference creates an implicit edge from app to network.
Understand how Terraform derives ordering from references, when explicit depends_on is justified, and how data sources differ from managed resources.
When one resource argument references another resource attribute, Terraform can infer ordering. This data-flow dependency is preferable because it documents why the dependency exists.
depends_on is useful for hidden behavioral dependencies that are not represented by an attribute reference. Overusing it makes plans more conservative and configuration harder to understand.
Managed resources create or update objects; data sources query information. Data-source results can feed resource arguments, but data sources do not turn unmanaged objects into managed ones.
resource "terraform_data" "network" { input = "net-a" }
resource "terraform_data" "app" {
input = "using-${terraform_data.network.output}"
}Goal: Create an implicit dependency and inspect it through plan and graph output.
mkdir -p ~/gnu-terraform-labs/module05 && cd ~/gnu-terraform-labs/module05
cat > main.tf <<'EOF'
resource "terraform_data" "foundation" {
input = "network-ready"
}
resource "terraform_data" "application" {
input = "app-${terraform_data.foundation.output}"
}
output "application" {
value = terraform_data.application.output
}
EOFterraform init
terraform planterraform apply -auto-approveterraform graph | head -30Good Terraform design expresses dependencies through data interfaces, which enables safe parallelism for independent graph branches.
Open each answer only after you have tried to answer the question yourself.
Through expression references between objects.
For a real dependency that cannot be represented through attribute data flow.
No; it reads data but does not establish managed ownership.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.