code: func (r *Resource) ShimInstanceStateFromValue(state cty.Value) (*terraform.InstanceState, error) {
  	// Get the raw shimmed value. While this is correct, the set hashes don't
  	// match those from the Schema.
  	s := terraform.NewInstanceStateShimmedFromValue(state, r.SchemaVersion)
  
  	// We now rebuild the state through the ResourceData, so that the set indexes
  	// match what helper/schema expects.
  	data, err := schemaMap(r.Schema).Data(s, nil)
  	if err != nil {
  		return nil, err
  	}
  
  	s = data.State()
  	if s == nil {
  		s = &terraform.InstanceState{}
  	}
  	return s, nil
  }
docs: // ShimInstanceStateFromValue converts a cty.Value to a
  // terraform.InstanceState.