Terraform apply is applying in in-correct order (patent / child module structure)

I think it’s hard to say from the information given here.

Broadly, I would try to keep modules inside of modules to a bare minimum (though you could look at tools like terragrunt, etc., as well as the new stacks feature to help with managing different environments), and if you want to create a dependency between a module you’re instantiating and resources declared in the same config / state, you’ll need to create an implicit dependency (usually preferred) or an explicit one.

This thread, while a slightly simpler use case, is probably a good one to look at: