Mirko
Mirko

Reputation: 21

Error parameters in yaml in GCP Deployment manager

I am attempting to use a python password generator result in a yaml GCP Deployment manager script, but it responds with an error that I cannot place.

    imports:
  - path: makepassword.py
  - path: bucket.py
  - path: database.py

resources:
  - name: rootpassgenerator
    type: makepassword.py

  - name: adminpassgenerator
    type: makepassword.py

  - name: promeva-bucket-config
    type: bucket.py

  - name: promeva-sql-config
    type: database.py
    properties:
      root-password: $(ref.rootpassgenerator.password)
      admin-password: $(ref.adminpassgenerator.password)
    metadata:
      dependsOn:
        - passwordgenerator
        - adminpassgenerator

outputs:
  - name: root
    value: $(ref.promeva-sql-config.rootpassword)
  - name: admin
    value: $(ref.promeva-sql-config.adminpassword)
  - name: rootpass
    value: $(ref.rootpassgenerator.password)
  - name: adminpass
    value: $(ref.adminpassgenerator.password)

The error I get is:

ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1603196290845-5b219396bcbcb-c6a53ee3-08291b3c]: errors:
- code: CONDITION_NOT_MET
  message: Referenced resource rootpassgenerator could not be found. In 'finalValue'
    section of 'outputs' in the manifest layout.

If I replace the two property lines with:

      root-password: 'qwerty'
      admin-password: 'asdfghj'

Then it works. The outputs parameters rootpass & adminpass display correctly generated passwords. I must be passing the property parameters in the wrong way, but I can't figure out how to do this correctly.

Any help would be appreciated.

Upvotes: 1

Views: 220

Answers (1)

Mirko
Mirko

Reputation: 21

I am not if my original question had an answer, but I solved it in another way. Since the password generator is a Python file, instead of 'generating' the password in the YAML file and passing it as a parameter, I simply included the password generator in the database.py file and generated the passwords there. It actually makes more sense this way.

I passed the generated passwords as outputs in the database.py file so I could still display them in the YAML file as outputs.

I hope this helps someone else working with Deployment manager

Upvotes: 1

Related Questions