code: func sniffCoreVersionRequirements(body hcl.Body) ([]VersionConstraint, hcl.Diagnostics) {
  	rootContent, _, diags := body.PartialContent(configFileVersionSniffRootSchema)
  
  	var constraints []VersionConstraint
  
  	for _, block := range rootContent.Blocks {
  		content, _, blockDiags := block.Body.PartialContent(configFileVersionSniffBlockSchema)
  		diags = append(diags, blockDiags...)
  
  		attr, exists := content.Attributes["required_version"]
  		if !exists {
  			continue
  		}
  
  		constraint, constraintDiags := decodeVersionConstraint(attr)
  		diags = append(diags, constraintDiags...)
  		if !constraintDiags.HasErrors() {
  			constraints = append(constraints, constraint)
  		}
  	}
  
  	return constraints, diags
  }
docs: // sniffCoreVersionRequirements does minimal parsing of the given body for
  // "terraform" blocks with "required_version" attributes, returning the
  // requirements found.
  //
  // This is intended to maximize the chance that we'll be able to read the
  // requirements (syntax errors notwithstanding) even if the config file contains
  // constructs that might've been added in future Terraform versions
  //
  // This is a "best effort" sort of method which will return constraints it is
  // able to find, but may return no constraints at all if the given body is
  // so invalid that it cannot be decoded at all.