how to iterate comma_delimited_list using %index% from OS::Heat::ResourceGroup?

asked 2016-05-22 05:31:58 -0600

Tomer gravatar image

updated 2016-05-25 09:24:37 -0600

Hi, I have a comma_delimited_list which represents list of fixed IP's and in my OS::Heat::ResourceGroup i want that each node will get one fixed ip based on his current index.

I have the following heat template (I've pasted only the relevant):

my_fixed_ips:
    type: comma_delimited_list

resources:
  MyResource:
    type: OS::Heat::ResourceGroup
    properties:
      count: { get_param: my_node_count }
      resource_def:
        type: MyTemplate.yaml
        properties:
          fixed_ip: { get_param: [ my_fixed_ips, %index% ] }
          name: myName%index%

when i run the command:

openstack stack create TomerProtected -e Environment.env -t Template.yaml -f yaml

I'm getting the error: found character '%' that cannot start any token

I've tried to set index_var to something else (index and not %index%) but still i can not get any specific value from the comma_delimited_list.

my question is- how to iterate comma_delimited_list using %index% from OS::Heat::ResourceGroup?

any ideas?

UPDATE:

I've found a solution by myself but it doesn't pleases me:

Ive changed index_var to: index Passed the comma_delimited_list and the current index from this template to MyTemplate.yaml. From MyTemplate.yaml I could get specific value from the comma_delimited_list:

fixed_ips: [ { "ip_address": { get_param: [ my_fixed_ips, get_param: index ] } } ]

but there most be a way to do this from OS::Heat::ResourceGroup

edit retag flag offensive close merge delete