Apply definitions in the correct order, and test more thoroughly.
set up parameters and policies before resources
So we can apply the right policies on resource creation, rather than
creating a whole bunch of resources with the "wrong" policies and then
changing to the right policy.

Also, process the various definitions in the same order everywhere,
for consistency.
Mergd bug25580 into stable