From 2e9fae23a5ffec182e8105385470354bd96401ca Mon Sep 17 00:00:00 2001 From: Meir Gabay Date: Thu, 30 Jul 2020 18:19:37 +0300 Subject: [PATCH] add test --- plugin_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugin_test.go b/plugin_test.go index d14e770..e0b9c80 100644 --- a/plugin_test.go +++ b/plugin_test.go @@ -9,6 +9,7 @@ import ( ) func TestPlugin(t *testing.T) { + os.Setenv("TEST_USER", "johndoe") g := Goblin(t) g.Describe("CopyTfEnv", func() { @@ -130,6 +131,11 @@ func TestPlugin(t *testing.T) { args{config: Config{Vars: map[string]string{"username": "someuser", "password": "1pass"}}}, exec.Command("terraform", "destroy", "-var", "username=someuser", "-var", "password=1pass", "-force"), }, + { + "with vars as env vars", + args{config: Config{Vars: map[string]string{"testuser": "${TEST_USER}"}}}, + exec.Command("terraform", "destroy", "-var", "testuser=johndoe", "-force"), + }, { "with var-files", args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}}, @@ -191,6 +197,12 @@ func TestPlugin(t *testing.T) { false, exec.Command("terraform", "plan", "-out=plan.tfout", "-var", "username=someuser", "-var", "password=1pass"), }, + { + "with vars as env vars", + args{config: Config{Vars: map[string]string{"testuser": "${TEST_USER}"}}}, + false, + exec.Command("terraform", "plan", "-out=plan.tfout", "-var", "testuser=johndoe"), + }, { "with var-files", args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}},