code: func (d *ResourceData) Set(key string, value interface{}) error {
  	d.once.Do(d.init)
  
  	// If the value is a pointer to a non-struct, get its value and
  	// use that. This allows Set to take a pointer to primitives to
  	// simplify the interface.
  	reflectVal := reflect.ValueOf(value)
  	if reflectVal.Kind() == reflect.Ptr {
  		if reflectVal.IsNil() {
  			// If the pointer is nil, then the value is just nil
  			value = nil
  		} else {
  			// Otherwise, we dereference the pointer as long as its not
  			// a pointer to a struct, since struct pointers are allowed.
  			reflectVal = reflect.Indirect(reflectVal)
  			if reflectVal.Kind() != reflect.Struct {
  				value = reflectVal.Interface()
  			}
  		}
  	}
  
  	err := d.setWriter.WriteField(strings.Split(key, "."), value)
  	if err != nil && d.panicOnError {
  		panic(err)
  	}
  	return err
  }
docs: // Set sets the value for the given key.
  //
  // If the key is invalid or the value is not a correct type, an error
  // will be returned.