diff --git a/DOCS.md b/DOCS.md index 5ed9ddf..9967d53 100644 --- a/DOCS.md +++ b/DOCS.md @@ -202,6 +202,9 @@ init_options.lock init_options.lock-timeout : Duration to wait for a state lock. Default `0s`. +init_options.plugin-dir +: Local path to use terraform plugins from. Default is `""` which will pull from upstream Terraform. + vars : a map of variables to pass to the Terraform `plan` and `apply` commands. Each value is passed as a `-var =` option. diff --git a/plugin.go b/plugin.go index 7321c03..f70b06f 100644 --- a/plugin.go +++ b/plugin.go @@ -45,6 +45,7 @@ type ( BackendConfig []string `json:"backend-config"` Lock *bool `json:"lock"` LockTimeout string `json:"lock-timeout"` + PluginDir string `json:"plugin-dir` } // Plugin represents the plugin instance to be executed @@ -205,6 +206,11 @@ func initCommand(config InitOptions) *exec.Cmd { args = append(args, fmt.Sprintf("-lock-timeout=%s", config.LockTimeout)) } + // "" is default in TF + if config.PluginDir != "" { + args = append(args, fmt.Sprintf("-plugin-dir=%s", config.PluginDir)) + } + // Fail Terraform execution on prompt args = append(args, "-input=false")