From d72defd0448f5b81177323c1b3a1099ccdaf8bcd Mon Sep 17 00:00:00 2001 From: Kristin Laemmert Date: Tue, 5 Mar 2019 08:32:11 -0800 Subject: [PATCH] command/show and state show: honor user-specified plugin-dir (#20557) Previously, these commands were not checking if the user specified a `-plugin-dir` flag during `terraform init` and would therefor fail if providers were not in one of the standard directories. Fixes #20547 --- command/show.go | 6 ++++++ command/state_show.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/command/show.go b/command/show.go index 7180ab394..2a32a120d 100644 --- a/command/show.go +++ b/command/show.go @@ -45,6 +45,12 @@ func (c *ShowCommand) Run(args []string) int { return 1 } + // Check for user-supplied plugin path + if c.pluginPath, err = c.loadPluginPath(); err != nil { + c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err)) + return 1 + } + var diags tfdiags.Diagnostics // Load the backend diff --git a/command/state_show.go b/command/state_show.go index a20dc8c59..e3aaf4866 100644 --- a/command/state_show.go +++ b/command/state_show.go @@ -35,6 +35,12 @@ func (c *StateShowCommand) Run(args []string) int { return cli.RunResultHelp } + // Check for user-supplied plugin path + if c.pluginPath, err = c.loadPluginPath(); err != nil { + c.Ui.Error(fmt.Sprintf("Error loading plugin path: %s", err)) + return 1 + } + // Load the backend b, backendDiags := c.Backend(nil) if backendDiags.HasErrors() {