Allow a way to pass per-instance data to ResourceGroup instances
Currently, it seems that instances of resources created by a ResourceGroup must be identical.
If there was a way to pass per-instance data that could be used when each resource is instantiated, that could be very helpful.
This could be helpful regarding these other blueprints also:
https:/
https:/
One idea would be to be able to pass a list of parameters for a resource.
For example, a Group of Nova Servers:
resources:
NonPilots:
type: OS::Heat:
properties:
count: 3
resource_def:
type: OS::Nova::Server
properties:
name: [ 'server1', 'server2', 'server3' ]
image: some_image
flavor: some_flavor
...
When the ResourceGroup spins up the instances, it would do so as follows:
instance_1:
properties:
name: server1
availabilit
image: some_image
flavor: some_flavor
instance_2:
properties:
name: server2
availabilit
image: some_image
flavor: some_flavor
instance_3:
properties:
name: server3
availabilit
image: some_image
flavor: some_flavor
The only catch would be that if a resource required a list as a parameter, that would have to be known beforehand - e.g., to pass a list of items through as a list, or to loop on each list item and pass as individual item. A list of lists could be used for a resource that requires a list parameter.
Blueprint information
- Status:
- Not started
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- Steve Lipinski
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- New
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
Was able to prototype this with the following change:
--- resource_
+++ resource_group.py 2014-03-25 16:18:13.603000518 -0400
@@ -145,14 +145,22 @@
def _assemble_
+
if resource_
if not include_all:
clean = dict((k, v) for k, v in resource_
- resources = dict((str(k), resource_def)
+
+ resources = dict((str(k), copy.deepcopy(
+
+ for i in range(count):
+ for k,v in resources[
+ if isinstance(v, list):
+ resources[
+
return child_template
Again, one shortcoming of this is that if one of the template parameters is supposed to be a list, this will break that. I'm not sure of how to look up a resource template to determine if the property is defined as a list.
This provides a lot of flexibility to ResourceGroups from what I have found.