code: func applyFn(ctx context.Context) error {
  	connState := ctx.Value(schema.ProvRawStateKey).(*terraform.InstanceState)
  	data := ctx.Value(schema.ProvConfigDataKey).(*schema.ResourceData)
  	o := ctx.Value(schema.ProvOutputKey).(terraform.UIOutput)
  
  	// Get a new communicator
  	comm, err := communicator.New(connState)
  	if err != nil {
  		return err
  	}
  
  	// Collect the scripts
  	scripts, err := collectScripts(data)
  	if err != nil {
  		return err
  	}
  	for _, s := range scripts {
  		defer s.Close()
  	}
  
  	// Copy and execute each script
  	if err := runScripts(ctx, o, comm, scripts); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // Apply executes the remote exec provisioner