Jump to: navigation, search

Heat/explode-resource-list

Use Case

Currently, resource-list only returns top-level resources of a given stack, this does not include resources that are inside of an existing nested stack. When deleting a stack, the user should be presented with a flat list of ALL resources associated with a given stack to avoid confusion about what and why certain resources were deleted due to a stack delete.

Implementation

The most efficient implementation to solve this use-case would be to pass an optional flag to the resource-list api endpoint that would indicate to the heat engine to recurse through all of the nested stacks and flatten the data structure as well as attach the original nested stack id to each resource to maintain the relationship between resource and nested stack.

Example Output

{"resources": 
 [
   {
     "resource_name": "db", 
     "links": [...], 
     "logical_resource_id": "db", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:23:35Z", 
     "required_by": ["web_nodes"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "4974985c-da78-444b-aeb3-9a80baccdd1a", 
     "resource_type": "OS::Trove::Instance"
     
   }, 
   {
     "resource_name": "lb", 
     "links": [...], 
     "logical_resource_id": "lb", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:30:52Z", 
     "required_by": [], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "229145", 
     "resource_type": "Rackspace::Cloud::LoadBalancer"
     
   }, 
   {
     "resource_name": "web_nodes", 
     "links": [...], 
     "logical_resource_id": "web_nodes", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:25:10Z", 
     "required_by": ["lb"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "c3a46e6f-f999-4f9b-a797-3043031d381a", 
     "resource_type": "OS::Heat::ResourceGroup"
     
   }, 
   {
     "resource_name": "web_node1", 
     "links": [...], 
     "logical_resource_id": "web_node1", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:25:10Z", 
     "required_by": ["lb"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "c3a46e6f-f999-4f9b-a797-3043031d3811", 
     "resource_type": "Rackspace::Cloud::Server",
     "parent": "web_nodes",
     "nested_stack_id": "1234512345"
   }, 
   {
     "resource_name": "web_node2", 
     "links": [...], 
     "logical_resource_id": "web_node2", 
     "resource_status_reason": "state changed", 
     "updated_time": "2014-04-15T18:25:10Z", 
     "required_by": ["lb"], 
     "resource_status": "CREATE_COMPLETE", 
     "physical_resource_id": "c3a46e6f-f999-4f9b-a797-3043031d3822", 
     "resource_type": "Rackspace::Cloud::Server",
     "parent": "web_nodes",
     "nested_stack_id": "1234512345"
   }
 ]
}