Creating an Apply For rule across multiple variables

I’ve not got any bites here or or on SOF so I believe this isn’t really possible. I thought if a function could return an object then perhaps an apply could iterate over a loop something like this:

// disclaimer: this is sort of a mock example, it may not make sense in detail but hopefully
// conveys the general idea
apply Service for (env => instance in host.vars.db_instances) {
  import "oracle-db-svc"
  var.check_cmd = "check_oracle_barcheck"
  for(svc_check in const_list_checks) {
    var.display_name = env + "-" + svc_check + "-barcheck"
    vars.svc_dbname = instance["dbname"]
    fn_create_service(check_cmd,display_name)
  }
}

But something tells me that wouldn’t work. So at this point I’m proceeding to an API solution but if anyone ever runs across this and has an idea, please let me know!

Andy