bundle agent sys_name_resolution_handler(prefix, params)
{
  vars:

    any::
      "$(prefix)editTable" string => "function_vars.$(prefix)edit";
      "$(prefix)editIdex"  slist  => getindices("$($(prefix)editTable)") ;

  methods:

     "$($(prefix)editIdex)"
        usebundle => doresolver(
                                 "$(prefix)",                                                # prefix
                                 @(sys_name_resolution_vars.sys_name_resolutionedittypes), # list
                                 "$($($(prefix)editTable)[$($(prefix)editIdex)][file])",                # file
                                 "$($($(prefix)editTable)[$($(prefix)editIdex)][nameserver])",          # nameserver
                                 "$($($(prefix)editTable)[$($(prefix)editIdex)][search])",              # search
                                 "$($($(prefix)editTable)[$($(prefix)editIdex)][domain])",              # domain
                                 "$($($(prefix)editTable)[$($(prefix)editIdex)][option])",              # option
                                 "$($($(prefix)editTable)[$($(prefix)editIdex)][sorlist])"              # sorlist
                               );
}

bundle agent doresolver(prefix,list,file,ns,s,d,o,sl)
{
  vars:

    "nameserver" string => "$(ns)";
    "search"     string => "$(s)";
    "domain"     string => "$(d)";
    "options"    string => "$(o)";
    "sorlist"    string => "$(sl)";

  classes:

    "$(prefix)$(list)_ok"
      not         => strcmp("$($(list))","");

  vars:

    "l_nameserver" slist => splitstring("$(ns)",",","99");
    "l_search"     slist => splitstring("$(s)",",","99");
    "l_domain"     slist => splitstring("$(d)",",","99");
    "l_options"    slist => splitstring("$(o)",",","99");
    "l_sorlist"    slist => splitstring("$(sl)",",","99");

  files:

    "$(file)"
      create        => "true",
      edit_line     => editresolv(
                                  "$(prefix)",
                                  @(this.list),
                                  @(this.l_nameserver),
                                  @(this.l_search),
                                  @(this.l_domain),
                                  @(this.l_options),
                                  @(this.l_sorlist)
                                 ),
      edit_defaults => inherit_all;

}

bundle edit_line editresolv(prefix,list,ns,s,d,o,sl)
{

  insert_lines:

    "nameserver $(ns)";
    "search $(s)";
    "domain $(d)";
    "option $(o)";
    "sorlist $(sl)";

  delete_lines:

    # To clean out junk
    "$(list) .*"
      ifvarclass => "$(prefix)$(list)_ok";
      #not_matching => "true",
}

body edit_defaults inherit_all
{
  inherit => "true";
}

Unit example