flatten nested variable expansions in the template to build vms