code: func sniffJSONStateTerraformVersion(src []byte) string {
  	type VersionSniff struct {
  		Version string `json:"terraform_version"`
  	}
  	var sniff VersionSniff
  
  	err := json.Unmarshal(src, &sniff)
  	if err != nil {
  		return ""
  	}
  
  	// Attempt to parse the string as a version so we won't report garbage
  	// as a version number.
  	_, err = version.NewVersion(sniff.Version)
  	if err != nil {
  		return ""
  	}
  
  	return sniff.Version
  }
docs: // sniffJSONStateTerraformVersion attempts to sniff the Terraform version
  // specification from the given state file source code. The result is either
  // a version string or an empty string if no version number could be extracted.
  //
  // This is a best-effort function intended to produce nicer error messages. It
  // should not be used for any real processing.