<div dir="ltr">I'm trying to find a way to create a set of servers and attach a new volume to each server. <div><br></div><div>I first tried to use block_device_mapping but that requires an existing snapshot or volume and the deployment would fail when Rackspace intermittently timed out trying to create the new volume from a snapshot. <div><br></div><div>I'm now trying with 3 ResourceGroups: OS::Cinder::Volume to build volumes followed by OS::Nova::Server and then trying to attach the volumes with OS::Cinder::VolumeAttachment.</div><div><br></div><div>This works when I do a single server and volume if I reference the VolumeAttachment properties like this:</div><div>volume_id: { get_attr: [group_volumes, refs, 0] }</div><div><br></div><div>Is there a way to add the index reference to the property when using get_attr? Something like this:</div><div>volume_id: { get_attr: [group_volumes, refs, %index%] }<br></div><div><br></div><div>Here is my template for reference:</div><div><br></div><div>heat_template_version: 2013-05-23</div><div><br></div><div>resources:</div><div>    group_volumes:</div><div>        type: "OS::Heat::ResourceGroup"</div><div>        properties:</div><div>            count: 1</div><div>            resource_def:</div><div>                type: "OS::Cinder::Volume"</div><div>                properties: </div><div>                    size: 150 </div><div>                    description: stack-test-vol-%index%</div><div>                    name: stack-test-vol-%index%</div><div>                    volume_type: SATA</div><div><br></div><div>    group_servers:</div><div>        type: "OS::Heat::ResourceGroup"</div><div>        properties:</div><div>            count: 1</div><div>            resource_def:</div><div>                type: "OS::Nova::Server"</div><div>                properties:</div><div>                    key_name: root-20140819</div><div>                    flavor: performance1-2</div><div>                    image: 255df5fb-e3d4-45a3-9a07-c976debf7c14</div><div>                    name: heat-test-withdisk-%index%</div><div>                    networks:</div><div>                        - uuid: 00000000-0000-0000-0000-000000000000</div><div>                        - uuid: 11111111-1111-1111-1111-111111111111</div><div>                    user_data: |</div><div>                        {"role":"build", "env":"test"}</div><div>                    user_data_format: RAW </div><div>                    config_drive: true</div><div><br></div><div>    attach_volumes:</div><div>        type: "OS::Heat::ResourceGroup"</div><div>        properties:</div><div>            count: 1</div><div>            resource_def:</div><div>                type: "OS::Cinder::VolumeAttachment"</div><div>                properties:</div><div>                    instance_uuid: { get_attr: [group_servers, refs, 0] }</div><div>                    mountpoint: /dev/xvdg</div><div>                    volume_id: { get_attr: [group_volumes, refs, 0] }</div><div><div>                #properties:  </div><div>                #    instance_uuid: { get_attr: [group_servers, refs, "%index%"] } #This doesn't work</div><div>                #    mountpoint: /dev/xvdg</div><div>                #    volume_id: { get_attr: [group_volumes, refs, "%index%"] }</div></div><div><br></div><div><br>-- <br><div dir="ltr"><font size="4" style="color:rgb(136,136,136)"><b><font face="courier new, monospace">Jason Greathouse</font></b><br></font><font face="courier new, monospace" color="#999999">Sr. Systems Engineer</font><div style="color:rgb(136,136,136);font-size:12.8000001907349px"><div><strong style="color:rgb(34,34,34)"><br><a href="https://leankit.com/" target="_blank" style="color:rgb(17,85,204)"><img src="http://leankit.com/assets/images/leankit.png" width="120" height="30" alt="LeanKitlogo"></a></strong></div></div></div>
</div></div></div>