Browse Source

adding plugin dir init option

pull/66/head
Steve Min 7 years ago
parent
commit
7c8fd97391
  1. 3
      DOCS.md
  2. 6
      plugin.go

3
DOCS.md

@ -202,6 +202,9 @@ init_options.lock
init_options.lock-timeout init_options.lock-timeout
: Duration to wait for a state lock. Default `0s`. : 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 vars
: a map of variables to pass to the Terraform `plan` and `apply` commands. : a map of variables to pass to the Terraform `plan` and `apply` commands.
Each value is passed as a `-var <key>=<value>` option. Each value is passed as a `-var <key>=<value>` option.

6
plugin.go

@ -45,6 +45,7 @@ type (
BackendConfig []string `json:"backend-config"` BackendConfig []string `json:"backend-config"`
Lock *bool `json:"lock"` Lock *bool `json:"lock"`
LockTimeout string `json:"lock-timeout"` LockTimeout string `json:"lock-timeout"`
PluginDir string `json:"plugin-dir`
} }
// Plugin represents the plugin instance to be executed // 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)) 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 // Fail Terraform execution on prompt
args = append(args, "-input=false") args = append(args, "-input=false")

Loading…
Cancel
Save