func ReferencesInBlock(body hcl.Body, schema *configschema.Block) ([]*addrs.Reference, tfdiags.Diagnostics) {
	if body == nil {
		return nil, nil
	}
	traversals := blocktoattr.ExpandedVariables(body, schema)
	return References(traversals)
}
ReferencesInBlock is a helper wrapper around References that first searches
the given body for traversals, before converting those traversals to
references.

A block schema must be provided so that this function can determine where in
the body variables are expected.
package lang
import (
	"github.com/hashicorp/hcl/v2"
	"github.com/hashicorp/terraform/addrs"
	"github.com/hashicorp/terraform/configs/configschema"
	"github.com/hashicorp/terraform/lang/blocktoattr"
	"github.com/hashicorp/terraform/tfdiags"
)
func References(traversals []hcl.Traversal) ([]*addrs.Reference, tfdiags.Diagnostics) {
	if len(traversals) == 0 {
		return nil, nil
	}
	var diags tfdiags.Diagnostics
	refs := make([]*addrs.Reference, 0, len(traversals))
	for _, traversal := range traversals {
		ref, refDiags := addrs.ParseRef(traversal)
		diags = diags.Append(refDiags)
		if ref == nil {
			continue
		}
		refs = append(refs, ref)
	}
	return refs, diags
}