terraform: fixing dependency handling for orphans