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
This commit is contained in:
Kristin Laemmert 2019-03-05 08:32:11 -08:00 committed by GitHub
parent 6c896bc456
commit d72defd044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View File

@ -45,6 +45,12 @@ func (c *ShowCommand) Run(args []string) int {
return 1 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 var diags tfdiags.Diagnostics
// Load the backend // Load the backend

View File

@ -35,6 +35,12 @@ func (c *StateShowCommand) Run(args []string) int {
return cli.RunResultHelp 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 // Load the backend
b, backendDiags := c.Backend(nil) b, backendDiags := c.Backend(nil)
if backendDiags.HasErrors() { if backendDiags.HasErrors() {