@@ -8,7 +8,9 @@ Puppet::Functions.create_function(:'results::make_apply_result') do
   end
 
   def create(uri, value)
-    target = Bolt::Target.new(uri)
+    inventory = Puppet.lookup(:bolt_inventory)
+    inventory.get_target(uri)
+    target = Bolt::Target.new(uri, inventory)
     Bolt::ApplyResult.new(target, error: value['_error'], report: value['report'])
   end
 end
# frozen_string_literal: true

Puppet::Functions.create_function(:'results::make_apply_result') do
  dispatch :create do
    param 'String', :uri
    param 'Hash', :value
    return_type 'ApplyResult'
  end

  def create(uri, value)
    target = Bolt::Target.new(uri)
    Bolt::ApplyResult.new(target, error: value['_error'], report: value['report'])
  end
end

`inventory.get_target(uri)` should already be returning a `Bolt::Target` instance