Resource References and Dependencies
Important Notice: Google Cloud Deployment Manager reached end of support on March 31, 2026. The information in this lesson is provided strictly as legacy reference for maintaining or migrating existing deployments. For all new infrastructure work, you should use Google Cloud Infrastructure Manager or Terraform.
What you'll learn: How legacy Google Cloud Deployment Manager resources were wired together using $(ref) syntax so one resource could automatically use values from another.
When reviewing legacy infrastructure code, you will notice that resources often need information from other resources that didn't exist until deployment time. For example, a Compute Engine instance might need to know the network ID created earlier in the same deployment file. This is where resource references were utilized.
How Resource References Work
In Google Cloud Deployment Manager, the $(ref.RESOURCE_NAME.PROPERTY) syntax was used to reference outputs or properties from another resource in a configuration. This created an implicit dependency—Deployment Manager knew it had to process the referenced resource first.
Think of it like a recipe: you can't frost a cake (reference) until the cake is baked (resource). Deployment Manager automatically figured out the correct order based on these references.
Basic Syntax
resources:
- name: my-network
type: compute.v1.network
properties:
autoCreateSubnetworks: false
- name: my-instance
type: compute.v1.instance
properties:
zone: us-central1-a
networkInterfaces:
- network: $(ref.my-network.selfLink)
In this legacy example, my-instance references my-network's selfLink property. When maintaining such configurations, Deployment Manager will:
- Process
my-networkfirst. - Wait for it to complete and become available.
- Extract its
selfLinkvalue. - Pass that value to
my-instanceduring creation or updates.
Why This Mattered
Without references, engineers would have had to manually deploy resources in stages, copying output values between separate deployments. References automated this orchestration within a single file, ensuring correct provisioning order and eliminating manual errors. Understanding this syntax is highly valuable when you are translating older Deployment Manager templates into modern Terraform configurations.
Key Takeaway: In legacy Google Cloud Deployment Manager templates, the $(ref.RESOURCE_NAME.PROPERTY) syntax was used to reference one resource's outputs as inputs for another, creating automatic dependencies and ensuring the correct deployment order.