func ParseModuleInstanceStr(str string) (ModuleInstance, tfdiags.Diagnostics) {
	var diags tfdiags.Diagnostics
	traversal, parseDiags := hclsyntax.ParseTraversalAbs([]byte(str), "", hcl.Pos{Line: 1, Column: 1})
	diags = diags.Append(parseDiags)
	if parseDiags.HasErrors() {
		return nil, diags
	}
	addr, addrDiags := ParseModuleInstance(traversal)
	diags = diags.Append(addrDiags)
	return addr, diags
}
ParseModuleInstanceStr is a helper wrapper around ParseModuleInstance
that takes a string and parses it with the HCL native syntax traversal parser
before interpreting it.

This should be used only in specialized situations since it will cause the
created references to not have any meaningful source location information.
If a reference string is coming from a source that should be identified in
error messages then the caller should instead parse it directly using a
suitable function from the HCL API and pass the traversal itself to
ParseModuleInstance.

Error diagnostics are returned if either the parsing fails or the analysis
of the traversal fails. There is no way for the caller to distinguish the
two kinds of diagnostics programmatically. If error diagnostics are returned
then the returned address is invalid.
package addrs
import (
	"bytes"
	"fmt"
	"github.com/hashicorp/hcl/v2"
	"github.com/hashicorp/hcl/v2/hclsyntax"
	"github.com/zclconf/go-cty/cty"
	"github.com/zclconf/go-cty/cty/gocty"
	"github.com/camptocamp/terraboard/internal/terraform/tfdiags"
)
type ModuleInstance []ModuleInstanceStep
var (
	_ Targetable = ModuleInstance(nil)
)
func ParseModuleInstance(traversal hcl.Traversal) (ModuleInstance, tfdiags.Diagnostics) {
	mi, remain, diags := parseModuleInstancePrefix(traversal)
	if len(remain) != 0 {
		if len(remain) == len(traversal) {
			diags = diags.Append(&hcl.Diagnostic{
				Severity: hcl.DiagError,
				Summary:  "Invalid module instance address",
				Detail:   "A module instance address must begin with \"module.\".",
				Subject:  remain.SourceRange().Ptr(),
			})
		} else {
			diags = diags.Append(&hcl.Diagnostic{
				Severity: hcl.DiagError,
				Summary:  "Invalid module instance address",
				Detail:   "The module instance address is followed by additional invalid content.",
				Subject:  remain.SourceRange().Ptr(),
			})
		}
	}
	return mi, diags
}