Ask Your Question
0

Joining variables in a heat template

asked 2015-05-11 07:05:46 -0500

chriscowley gravatar image

Say I want to name a a resource based on 2 variables so I have something like:

heat_template_version: 2013-05-23

description: Create network with

parameters:
  client_code:
    type: string
    description: 4 character customer code. Will be used for instance naming
  project_code:
    type: string
    description: 3 character project code

Now I would like to create resource with the name based on the client and project:

resources:
  test:
    type: OS::Neutron::Net
    properties:
      name: {get_param: client_code}{get_param: project_code}

That resource creation gives me a parse error. Is there anyway I can achieve this, or do I need to use a pre-script to generate my template?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-05-12 09:44:58 -0500

chriscowley gravatar image

I found a solution using str_replace. My code looks something like:

heat_template_version: 2013-05-23

description: Create network with

parameters:
  client_code:
    type: string
    description: 4 character customer code. Will be used for instance naming
  project_code:
    type: string
    description: 3 character project code

resources:
  test:
    type: OS::Neutron::Net
    properties:
      name:
        str_replace:
        template: cust%-proj%
        params:
          "cust%": { get_param: client_code } 
          "proj%": { get_param: project_code }
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2015-05-11 07:05:46 -0500

Seen: 554 times

Last updated: May 12 '15