code: func (b *binary) SetLocalState(state *states.State) error {
  	path := b.Path("terraform.tfstate")
  	f, err := os.OpenFile(path, os.O_TRUNC|os.O_CREATE|os.O_WRONLY, os.ModePerm)
  	if err != nil {
  		return fmt.Errorf("failed to create temporary state file %s: %s", path, err)
  	}
  	defer f.Close()
  
  	sf := &statefile.File{
  		Serial:  0,
  		Lineage: "fake-for-testing",
  		State:   state,
  	}
  	return statefile.Write(sf, f)
  }
docs: // SetLocalState is a helper for easily writing to the file the local backend
  // uses for state in the working directory. This does not go through the
  // actual local backend code, so processing such as management of serials
  // does not apply and the given state will simply be written verbatim.