code: func collectScripts(d *schema.ResourceData) ([]io.ReadCloser, error) {
  	// Check if inline
  	if _, ok := d.GetOk("inline"); ok {
  		scripts, err := generateScripts(d)
  		if err != nil {
  			return nil, err
  		}
  
  		var r []io.ReadCloser
  		for _, script := range scripts {
  			r = append(r, ioutil.NopCloser(bytes.NewReader([]byte(script))))
  		}
  
  		return r, nil
  	}
  
  	// Collect scripts
  	var scripts []string
  	if script, ok := d.GetOk("script"); ok {
  		scr, ok := script.(string)
  		if !ok {
  			return nil, fmt.Errorf("Error parsing script %v as string", script)
  		}
  		scripts = append(scripts, scr)
  	}
  
  	if scriptList, ok := d.GetOk("scripts"); ok {
  		for _, script := range scriptList.([]interface{}) {
  			scr, ok := script.(string)
  			if !ok {
  				return nil, fmt.Errorf("Error parsing script %v as string", script)
  			}
  			scripts = append(scripts, scr)
  		}
  	}
  
  	// Open all the scripts
  	var fhs []io.ReadCloser
  	for _, s := range scripts {
  		fh, err := os.Open(s)
  		if err != nil {
  			for _, fh := range fhs {
  				fh.Close()
  			}
  			return nil, fmt.Errorf("Failed to open script '%s': %v", s, err)
  		}
  		fhs = append(fhs, fh)
  	}
  
  	// Done, return the file handles
  	return fhs, nil
  }
docs: // collectScripts is used to collect all the scripts we need
  // to execute in preparation for copying them.