make display plugin checksum error to user

The error follows a generic message, so can be ignored by users who may
not understand the implications.
This commit is contained in:
James Bardin 2017-06-22 13:38:55 -04:00
parent 5be15ed77c
commit 7a955f990c
2 changed files with 4 additions and 11 deletions

View File

@ -412,20 +412,18 @@ func (b *Local) stateWorkspaceDir() string {
func (b *Local) pluginInitRequired(providerErr *terraform.ResourceProviderError) {
b.CLI.Output(b.Colorize().Color(fmt.Sprintf(
strings.TrimSpace(errPluginInit)+"\n",
"Could not satisfy plugin requirements",
providerErr)))
}
// this relies on multierror to format the plugin errors below the copy
const errPluginInit = `
[reset][bold][yellow]Plugin reinitialization required. Please run "terraform init".[reset]
[yellow]Reason: %s
[yellow]Reason: Could not satisfy plugin requirements.
Plugins are external binaries that Terraform uses to access and manipulate
resources. If this message is showing up, it means that the configuration you
have references plugins which can't be located, don't satisfy the version
constraints, or are otherwise incompatible.
The errors encountered discovering plugins are:
%s
[reset][red]%s
`

View File

@ -53,12 +53,7 @@ func (r *multiVersionProviderResolver) ResolveProviders(
continue
}
if !reqd[name].AcceptsSHA256(digest) {
// This generic error message is intended to avoid troubling
// users with implementation details. The main useful point
// here is that they need to run "terraform init" to
// fix this, which is covered by the UI code reporting these
// error messages.
errs = append(errs, fmt.Errorf("provider.%s: installed but not yet initialized", name))
errs = append(errs, fmt.Errorf("provider.%s: checksum mismatch", name))
continue
}