0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-21 14:20:40 +00:00

add tests for vars and var_files

This commit is contained in:
Jacob McCann 2018-07-31 13:46:41 -05:00
parent 779aa5abaa
commit 4858bea4e6

View File

@ -87,6 +87,16 @@ func TestPlugin(t *testing.T) {
args{config: Config{Targets: []string{"target1", "target2"}}}, args{config: Config{Targets: []string{"target1", "target2"}}},
exec.Command("terraform", "destroy", "-target=target1", "-target=target2", "-force"), exec.Command("terraform", "destroy", "-target=target1", "-target=target2", "-force"),
}, },
{
"with vars",
args{config: Config{Vars: map[string]string{"username": "someuser", "password": "1pass"}}},
exec.Command("terraform", "destroy", "-var", "username=someuser", "-var", "password=1pass", "-force"),
},
{
"with var-files",
args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}},
exec.Command("terraform", "destroy", "-var-file=common.tfvars", "-var-file=prod.tfvars", "-force"),
},
} }
for _, tt := range tests { for _, tt := range tests {
@ -119,6 +129,18 @@ func TestPlugin(t *testing.T) {
true, true,
exec.Command("terraform", "plan", "-destroy"), exec.Command("terraform", "plan", "-destroy"),
}, },
{
"with vars",
args{config: Config{Vars: map[string]string{"username": "someuser", "password": "1pass"}}},
false,
exec.Command("terraform", "plan", "-out=plan.tfout", "-var", "username=someuser", "-var", "password=1pass"),
},
{
"with var-files",
args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}},
false,
exec.Command("terraform", "plan", "-out=plan.tfout", "-var-file=common.tfvars", "-var-file=prod.tfvars"),
},
} }
for _, tt := range tests { for _, tt := range tests {