in types/hcl.go [401:416]
func CommentOutBlock(block *hclwrite.Block) hclwrite.Tokens {
file := hclwrite.NewEmptyFile()
file.Body().AppendBlock(block)
content := string(file.Bytes())
lines := strings.Split(content, "\n")
for i, line := range lines {
lines[i] = fmt.Sprintf("# %s", line)
}
return hclwrite.Tokens{
&hclwrite.Token{
Type: hclsyntax.TokenComment,
Bytes: []byte(strings.Join(lines, "\n")),
SpacesBefore: 0,
},
}
}