Fix dependency handling of modules

This PR fixes the handling of module dependencies. Unlike resources, module dependencies were not persisted
to a state file. This means that orphaned modules lose dependency information required to safely perform a tear-down.
We now encode the per-module dependency information in the state file to handle orphans. Additionally, a total destroy
(via "terraform destroy") and orphan modules failed to properly invert module dependencies, causing the destroy order
to be incorrect, which is now fixed.

Fixes #584.
/cc: @mitchellh