Revision history [back]

click to hide/show revision 1
initial version

How can I use a 1 based index for naming servers in a ResourceGroup?

So I have a working Heat ResourceGroup as follows:

resources:
  servers:
    type: OS::Heat::ResourceGroup
    properties:
      count: { get_param: server_count }
      resource_def:
        type: { get_param: template }
        properties:
          ssh_key: { get_param: ssh_key }
          parent_stack_id: { get_param: "OS::stack_id" }
          server_image: { get_param: server_image }
          server_flavor: { get_param: server_flavor }
          server_name:
            str_replace:
              template: ${STACK}-%index%
              params:
                ${STACK}: { get_param: "OS::stack_name" }

And this creates servers with names like this:

server-0
server-1
...
server-10

But what we would really like to have are servers named with a 1 based index like this:

server-01
server-02
...
server-10

Is there any way to do this in Heat? (I'm using Rackspace so it should be the current OpenStack release)