Skip to main content
deleted 31 characters in body
Source Link
seawolf
  • 2.2k
  • 3
  • 20
  • 39
% gcloud --project myproject deployment-manager deployments update test-deploy --config config.yaml --preview
The fingerprint of the deployment is b'5Hesgz1ujBJIotnjwJHJsg=='
Waiting for update [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]...failed.                                                                         
ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]: errors:
- code: CONDITION_NOT_MET
  message: Referenced resource softcoded-1 could not be found. In 'finalValue' section
    of 'outputs' in the manifest layout.
 
make: *** [preview] Error 1
% gcloud --project myproject deployment-manager deployments update test-deploy --config config.yaml --preview
The fingerprint of the deployment is b'5Hesgz1ujBJIotnjwJHJsg=='
Waiting for update [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]...failed.                                                                         
ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]: errors:
- code: CONDITION_NOT_MET
  message: Referenced resource softcoded-1 could not be found. In 'finalValue' section
    of 'outputs' in the manifest layout.
 
make: *** [preview] Error 1
% gcloud --project myproject deployment-manager deployments update test-deploy --config config.yaml --preview
The fingerprint of the deployment is b'5Hesgz1ujBJIotnjwJHJsg=='
Waiting for update [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]...failed.                                                                         
ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]: errors:
- code: CONDITION_NOT_MET
  message: Referenced resource softcoded-1 could not be found. In 'finalValue' section
    of 'outputs' in the manifest layout.
Source Link
seawolf
  • 2.2k
  • 3
  • 20
  • 39

Google Deployment Manager References not Working as Expected

I have a trivial deployment manager configuration as I try to understand using references and outputs from templates. Note that all examples are overly-simplified just to demonstrate the problem; obviously in a final version much more would be dynamic.

My first file is a low-level template designed to create a bucket with a dynamic name:

file: bucket.jinja

{% set NAME = properties['name'] %}

resources:
  - name: templated-{{ NAME }}
    type: storage.v1.bucket
    properties:
      location: us-central1
      kind: storage#bucket
      storageClass: STANDARD
      versioning:
        enabled: false

outputs:
  - name: outValue
    value: out-{{ NAME }}

My second file is a higher-level template to control the deployment:

file config.yaml

imports:
  - path: bucket.jinja

resources:
  - name: softcoded-1
    type: bucket.jinja
    properties:
      name: testbucket

  - name: hardcoded-$(ref.softcoded-1.outValue)
    type: storage.v1.bucket
    properties:
      location: us-central1
      kind: storage#bucket
      storageClass: STANDARD
      versioning:
        enabled: false

  - name: softcoded-2
    type: bucket.jinja
    properties:
      name: noref
    metadata:
      dependsOn:
        - softcoded-1

  - name: softcoded-3
    type: bucket.jinja
    properties:
      name: $(ref.softcoded-1.outValue)
    metadata:
      dependsOn:
        - softcoded-1

When I try to run this, I get the following error:

% gcloud --project myproject deployment-manager deployments update test-deploy --config config.yaml --preview
The fingerprint of the deployment is b'5Hesgz1ujBJIotnjwJHJsg=='
Waiting for update [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]...failed.                                                                         
ERROR: (gcloud.deployment-manager.deployments.update) Error in Operation [operation-1709425554385-612b6a6f06adf-8d791850-cffb5f4a]: errors:
- code: CONDITION_NOT_MET
  message: Referenced resource softcoded-1 could not be found. In 'finalValue' section
    of 'outputs' in the manifest layout.

make: *** [preview] Error 1

However, if I remove the softcoded-3 resource, everything deploys as expected:

gcloud --project myproject deployment-manager deployments update test-deploy --config config.yaml --preview
The fingerprint of the deployment is b'mBk3HFf8zrIx1QQu0qEX9w=='
Waiting for update [operation-1709425600759-612b6a9b406a3-1d4b478a-b4f12123]...done.                                                                           
Update operation operation-1709425600759-612b6a9b406a3-1d4b478a-b4f12123 completed successfully.
NAME                      TYPE               STATE       ERRORS  INTENT
hardcoded-out-testbucket  storage.v1.bucket  IN_PREVIEW  []      CREATE_OR_ACQUIRE
templated-noref           storage.v1.bucket  IN_PREVIEW  []      CREATE_OR_ACQUIRE
templated-testbucket      storage.v1.bucket  IN_PREVIEW  []      CREATE_OR_ACQUIRE

If I restore the softcoded-3 resource, I would expect an additional bucket to be created with the resolved name templated-out-testbucket.

This seems to be in direct conflict with this example in Google's own docs, which shows a template outputting a value and the calling template then consuming that value as a property on another resource.

What am I missing in order to make this create the softcoded-3 resource without errors?