We want to create a heat templates with servers and volumes attached to these servers. But we also want to be able to destroy all quickly servers without destroying volumes.
So we decided it would be best to make 2 heat templates instead of one : - one for volumes - one for servers and volume attachements
We would like something like that :
stack-for-volume.yml
description: project
heat_template_version: '2015-10-15'
resources:
volume-choca-01:
type: OS::Cinder::Volume
properties:
name: volume-choca-01
size: 15
stack-for-servers-and-attachments.yml
description: project
heat_template_version: '2015-10-15'
resources:
vm-choca-01:
type: OS::Nova::Server
properties:
flavor: CO.2
image: Centos 7
key_name: choca
name: vm-choca-01
networks:
- {network: net-ext}
security_groups: [default]
volume-attachment-01:
type: OS::Cinder::VolumeAttachment
properties:
instance_uuid: { get_resource: vm-choca-01 }
volume_id: { get_resource: volume-choca-01 }
Of course since all resources are not in the same file:
volume_id: { get_resource: volume-choca-01 }
can't work.
We tried to get the volume_id with the solution posted here : Openstack Heat - separate templates by adding at the end stack-for-volume.yml :
outputs:
volume-choca-01-id:
description: something
value: { get_attr: [volume-choca-01] }
But the output didn't give us anything looking like the volume id. We´re stuck right now.
Any idea ?