configs/configupgrade: Pass through diagnostics from body upgrades

This commit is contained in:
Martin Atkins 2018-11-30 15:55:18 -08:00
parent c755745285
commit 302b29557f

View File

@ -141,7 +141,8 @@ func (u *Upgrader) upgradeNativeSyntaxFile(filename string, src []byte, an *anal
"map": `map(string)`, "map": `map(string)`,
}), }),
} }
u.upgradeBlockBody(filename, fmt.Sprintf("var.%s", labels[0]), &buf, body.List.Items, rules, adhocComments) bodyDiags := u.upgradeBlockBody(filename, fmt.Sprintf("var.%s", labels[0]), &buf, body.List.Items, rules, adhocComments)
diags = diags.Append(bodyDiags)
buf.WriteString("}\n\n") buf.WriteString("}\n\n")
case "output": case "output":
@ -164,7 +165,8 @@ func (u *Upgrader) upgradeNativeSyntaxFile(filename string, src []byte, an *anal
"sensitive": noInterpAttributeRule(filename, cty.Bool, an), "sensitive": noInterpAttributeRule(filename, cty.Bool, an),
"depends_on": dependsOnAttributeRule(filename, an), "depends_on": dependsOnAttributeRule(filename, an),
} }
u.upgradeBlockBody(filename, fmt.Sprintf("output.%s", labels[0]), &buf, body.List.Items, rules, adhocComments) bodyDiags := u.upgradeBlockBody(filename, fmt.Sprintf("output.%s", labels[0]), &buf, body.List.Items, rules, adhocComments)
diags = diags.Append(bodyDiags)
buf.WriteString("}\n\n") buf.WriteString("}\n\n")
case "locals": case "locals":
@ -287,7 +289,8 @@ func (u *Upgrader) upgradeNativeSyntaxResource(filename string, buf *bytes.Buffe
printComments(buf, item.LeadComment) printComments(buf, item.LeadComment)
printBlockOpen(buf, blockType, labels, item.LineComment) printBlockOpen(buf, blockType, labels, item.LineComment)
u.upgradeBlockBody(filename, addr.String(), buf, body.List.Items, rules, adhocComments) bodyDiags := u.upgradeBlockBody(filename, addr.String(), buf, body.List.Items, rules, adhocComments)
diags = diags.Append(bodyDiags)
buf.WriteString("}\n\n") buf.WriteString("}\n\n")
return diags return diags
@ -309,7 +312,8 @@ func (u *Upgrader) upgradeNativeSyntaxProvider(filename string, buf *bytes.Buffe
printComments(buf, item.LeadComment) printComments(buf, item.LeadComment)
printBlockOpen(buf, "provider", []string{typeName}, item.LineComment) printBlockOpen(buf, "provider", []string{typeName}, item.LineComment)
u.upgradeBlockBody(filename, fmt.Sprintf("provider.%s", typeName), buf, body.List.Items, rules, adhocComments) bodyDiags := u.upgradeBlockBody(filename, fmt.Sprintf("provider.%s", typeName), buf, body.List.Items, rules, adhocComments)
diags = diags.Append(bodyDiags)
buf.WriteString("}\n\n") buf.WriteString("}\n\n")
return diags return diags