code: func (o *ResourceInstanceObject) Encode(ty cty.Type, schemaVersion uint64) (*ResourceInstanceObjectSrc, error) {
  	// Our state serialization can't represent unknown values, so we convert
  	// them to nulls here. This is lossy, but nobody should be writing unknown
  	// values here and expecting to get them out again later.
  	//
  	// We get unknown values here while we're building out a "planned state"
  	// during the plan phase, but the value stored in the plan takes precedence
  	// for expression evaluation. The apply step should never produce unknown
  	// values, but if it does it's the responsibility of the caller to detect
  	// and raise an error about that.
  	val := cty.UnknownAsNull(o.Value)
  
  	src, err := ctyjson.Marshal(val, ty)
  	if err != nil {
  		return nil, err
  	}
  
  	return &ResourceInstanceObjectSrc{
  		SchemaVersion: schemaVersion,
  		AttrsJSON:     src,
  		Private:       o.Private,
  		Status:        o.Status,
  		Dependencies:  o.Dependencies,
  	}, nil
  }
docs: // Encode marshals the value within the receiver to produce a
  // ResourceInstanceObjectSrc ready to be written to a state file.
  //
  // The given type must be the implied type of the resource type schema, and
  // the given value must conform to it. It is important to pass the schema
  // type and not the object's own type so that dynamically-typed attributes
  // will be stored correctly. The caller must also provide the version number
  // of the schema that the given type was derived from, which will be recorded
  // in the source object so it can be used to detect when schema migration is
  // required on read.
  //
  // The returned object may share internal references with the receiver and
  // so the caller must not mutate the receiver any further once once this
  // method is called.