mattolenik/hclq

GetAsString: found but is of wrong type, query requested key/literal, found list"

sebglon opened this issue · 2 comments

I use this code:

	tfParamPath := "module." + moduleName + "." + field
	hclDoc, err := hclq.FromFile(file)
	if err != nil {
		return []string{}, errors.Wrapf(err, "Failed to read terraform file: %s", file)
	}
	res, err := hclDoc.GetAsList(tfParamPath)

But it fail with error:
key 'partner_ips' found but is of wrong type, query requested key/literal, found list

I use github.com/mattolenik/hclq v0.0.0-20190520172613-e55c48cdefcc

Solved.
Sorry i have lost [] at the end of the query

Well the error message certainly could be improved, so thanks for raising the issue! I opened #18 to track improving the message.