From 6f55358146a06475829b6c1e0f74e334e2ac6e3b Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 29 Jul 2018 09:56:49 +0800 Subject: [PATCH] fix: -var-file option to match terraform command format --- plugin.go | 4 ++-- plugin_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin.go b/plugin.go index bb643bb..70e53da 100644 --- a/plugin.go +++ b/plugin.go @@ -39,7 +39,7 @@ func pkValidate(config Config) *exec.Cmd { } for _, v := range config.VarFiles { - args = append(args, "-var-file", fmt.Sprintf("%s", v)) + args = append(args, fmt.Sprintf("-var-file=%s", v)) } for k, v := range config.Vars { @@ -72,7 +72,7 @@ func pkBuild(config Config) *exec.Cmd { } for _, v := range config.VarFiles { - args = append(args, "-var-file", fmt.Sprintf("%s", v)) + args = append(args, fmt.Sprintf("-var-file=%s", v)) } for k, v := range config.Vars { diff --git a/plugin_test.go b/plugin_test.go index 4a6b535..913d603 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -35,7 +35,7 @@ func Test_pkValidate(t *testing.T) { VarFiles: []string{"bar.json"}, }, }, - want: exec.Command("packer", "validate", "-var-file", "bar.json", "-var", "foo=bar", "foo.json"), + want: exec.Command("packer", "validate", "-var-file=bar.json", "-var", "foo=bar", "foo.json"), }, { name: "add except only color flag", @@ -89,7 +89,7 @@ func Test_pkBuild(t *testing.T) { VarFiles: []string{"bar.json"}, }, }, - want: exec.Command("packer", "build", "-var-file", "bar.json", "-var", "foo=bar", "foo.json"), + want: exec.Command("packer", "build", "-var-file=bar.json", "-var", "foo=bar", "foo.json"), }, { name: "add Parallel, Color and debug flag",