adler/awsheet — pull request #6 by jl2501 (2014-06-03 14:26:28+00:00)
Title: WE SELL YOU THE WHOLE SEAT, BUT YOU'LL ONLY USE THE EDDDDGGGGEEE!!!

Minor core additions:
* resource reference table (resource_ref)
* method to determine if a string fits the format of a resource reference.

Core Heet Protocol addition:
* add_dependent_resource method
-takes 2 arguments:
1) resource object that is depending on somehting else to happen before it can converge
2) a string to be passed back to the resource object call back method that can be used as an identifier of why it is being called back
add_dependent_resource adds the passed object's converge_dependency method to the list of functions to be called at_exit.
Only objects that implement converge_dependency as a function that takes 2 arguments (one being the key string passed in) can use this
type of convergence pattern and the work for matching up the key name to a set of needed operations is completely left to the resource objects.

Helper Addition:
Security Groups can now refer to other security groups in the same module by using notation of prefixing the security group's Heet Base Name
with an '@' sign.
This allows security groups to contain references to other groups in the heet module which may not exist yet when resources are being converged.
The current pattern just asks Heet to call them back at Exit (via heet.add_dependent_resource() ---> securitygrouphelper_object.converge_dependency())

This also changes the deletion pattern to be able to handle the same type of situation where one can't delete a group because there are other groups that
list it in their rules. The same pattern occurs. In this case, in the destroy cycle, groups will delete all of their rules that refer to any other groups
so as to free those groups to be able to delete themselves. If a group tries to delete itself and it fails, it will register itself as a dependent and will
try again after the other groups in the module have deleted all of their rules that may refer to it.

Instances are generally placed after security groups in Heet module scripts, and because the destroy is run in reverse order from declaration, instances
will generally be deleted already by the time the security groups try to delete themselves. Code has been added to the instancehelper module to make sure
an instance is in the terminated state before its destroy cycle ends, thus helping these security groups to be able todelete themselves at destroy time.