title: CONDITION_NOT_MET for references in GCP deployment template
body: <p>Given the configuration file <code>ref-template.yaml</code>, which deploys a VM and route:</p>
  <pre><code>imports:
  - path: pc-template.py
  - path: route-template.py
  
  
  resources:
  - type: route-template.py
    name: route-1a
    properties:
      network: vpc-1a
      nextHopInstance: $(ref.pcB.selfLink)
      destIp: 172.26.17.31
      priority: 5
  - name: pcB
    type: pc-template.py
    properties:
      subnet: subnet-1b
      networkIP: 172.26.17.31
      igw: 172.26.17.1
      peerCIDR: 172.26.16.0/24
      pc: a
  </code></pre>
  <p>I want to reference the VM in the route to point the next hop instance to it.  I'm getting the following error when trying to deploy:</p>
  <pre><code>$ gcloud deployment-manager deployments create ref-practice --config ref-template.yaml
  The fingerprint of the deployment is b'ZglqZosfmUxLHYuYUJEI6A=='
  Waiting for create [operation-1646540994601-5d98533176193-cc77e438-959a4384]...failed.                                                                                            
      ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1646540994601-5d98533176193-cc77e438-959a4384]: errors:
  - code: CONDITION_NOT_MET
    message: Referenced resource pcB could not be found. At resource route-1a.
  </code></pre>
  <p>The <a href="https://cloud.google.com/deployment-manager/docs/configuration/use-references#making_references_in_configuration_files" rel="nofollow noreferrer">deployment manager docs</a> on adding references states that references should be of the format:</p>
  <pre><code>$(ref.RESOURCE_NAME.PROPERTY)
  </code></pre>
  <p>In my case, <code>RESOURCE_NAME = pcB</code>.  I'm at a loss for what is wrong with my expression, or how I can debug it any further.</p>