Ask Your Question

Using local environment variables in heat template

asked 2015-04-15 04:45:36 -0500

ccowley gravatar image

I want to create an instance that can hit the same API endpoints as I am using create my stack. These endpoints could vary from usage to usage, but they will always be the same as the ones I use to create the instance. As a result I would like to automatically put my credentials (OS_AUTH_URL etc) into my template to inject them into the instance via cloud-init.

How can I do something like:

Parameters :
  os_auth_url :
    default: env[OS_AUTH_URL]
  os_username :
    default: env[OS_AUTH_URL]

Resources :
          "%os_auth_url%": {get_param: os_auth_url }
          "%os_username%": {get_param: os_username }

        template: |
          - content: |
              export OS_AUTH_URL=%os_auth_url%
              export OS_USERNAME=%os_username%
            path: /home/cloud/authcreds.rc

At the moment, my solution is to create a that I then pass through sed to create my actual template. Is there a way I can do this natively in Heat?

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2015-08-05 19:38:15 -0500

asalkeld gravatar image

Remember that the template is used in the cloud (so there is no access to your env).

A different way to do this is:

heat stack-create -f template.yaml -P "os_auth_url=$OS_AUTH_URL;os_username=$OS_AUTH_URL"
edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2015-04-15 04:42:42 -0500

Seen: 1,607 times

Last updated: Aug 05 '15