in helper/utils.go [83:100]
func ListHclBlocks(workingDirectory string) []*hclwrite.Block {
res := make([]*hclwrite.Block, 0)
files := ListHclFiles(workingDirectory)
for _, file := range files {
filePath := path.Join(workingDirectory, file.Name())
// #nosec G304
f, err := os.ReadFile(filePath)
if err != nil {
continue
}
hclFile, diags := hclwrite.ParseConfig(f, file.Name(), hcl.InitialPos)
if diags.HasErrors() {
continue
}
res = append(res, hclFile.Body().Blocks()...)
}
return res
}