addrs: Fix diagnostic for invalid provider type

This previously rendered as `Invalid provider type ""`, as `name` was
empty if parsing failed. Using the source string is more helpful.
This commit is contained in:
Alisdair McDiarmid 2020-04-01 14:26:04 -04:00
parent 7165d6c429
commit cadc133828
1 changed files with 1 additions and 1 deletions

View File

@ -192,7 +192,7 @@ func ParseProviderSourceString(str string) (Provider, tfdiags.Diagnostics) {
diags = diags.Append(&hcl.Diagnostic{ diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError, Severity: hcl.DiagError,
Summary: "Invalid provider type", Summary: "Invalid provider type",
Detail: fmt.Sprintf(`Invalid provider type %q in source %q: %s"`, name, str, err), Detail: fmt.Sprintf(`Invalid provider type %q in source %q: %s"`, givenName, str, err),
}) })
return ret, diags return ret, diags
} }