Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: terramate.config.git block with unrecognized blocks #359

Merged
merged 20 commits into from
May 30, 2022
Merged
9 changes: 7 additions & 2 deletions hcl/hcl.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,15 +760,20 @@ func parseRootConfig(cfg *RootConfig, block *hclsyntax.Block) error {
return errs.AsError()
}

func parseGitConfig(git *GitConfig, block *hclsyntax.Block) error {
func parseGitConfig(git *GitConfig, gitBlock *hclsyntax.Block) error {
logger := log.With().
Str("action", "parseGitConfig()").
Logger()

logger.Trace().Msg("Range over block attributes.")

errs := errors.L()
for _, attr := range sortedAttributes(block.Body.Attributes) {

for _, block := range gitBlock.Body.Blocks {
errs.Append(errors.E(block.TypeRange, "unrecognized block %q", block.Type))
}

for _, attr := range sortedAttributes(gitBlock.Body.Attributes) {
attrVal, diags := attr.Expr.Value(nil)
if diags.HasErrors() {
errs.Append(errors.E(diags,
Expand Down