From 7a955f990c20a70fa2b3006b9c82327cd4375b51 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 22 Jun 2017 13:38:55 -0400 Subject: [PATCH] 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. --- backend/local/backend.go | 8 +++----- command/plugins.go | 7 +------ 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/backend/local/backend.go b/backend/local/backend.go index 02152c17c..62b9174d8 100644 --- a/backend/local/backend.go +++ b/backend/local/backend.go @@ -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 ` diff --git a/command/plugins.go b/command/plugins.go index 6ce642727..f71b2bc9c 100644 --- a/command/plugins.go +++ b/command/plugins.go @@ -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 }