config: test for var uniqueness in overrides

This commit is contained in:
Mitchell Hashimoto 2016-08-26 13:48:21 -07:00
parent fbf06e2a59
commit 0fceeaaeb0
No known key found for this signature in database
GPG Key ID: 744E147AA52F5B0A
3 changed files with 29 additions and 0 deletions

View File

@ -446,6 +446,22 @@ func TestLoadDir_override(t *testing.T) {
}
}
func TestLoadDir_overrideVar(t *testing.T) {
c, err := LoadDir(filepath.Join(fixtureDir, "dir-override-var"))
if err != nil {
t.Fatalf("err: %s", err)
}
if c == nil {
t.Fatal("config should not be nil")
}
actual := variablesStr(c.Variables)
if actual != strings.TrimSpace(dirOverrideVarsVariablesStr) {
t.Fatalf("bad:\n%s", actual)
}
}
func TestLoadFile_mismatchedVariableTypes(t *testing.T) {
_, err := LoadFile(filepath.Join(fixtureDir, "variable-mismatched-type.tf"))
if err == nil {
@ -922,6 +938,12 @@ foo
bar
`
const dirOverrideVarsVariablesStr = `
foo
baz
bar
`
const importProvidersStr = `
aws
bar

View File

@ -0,0 +1,4 @@
variable "foo" {
default = "bar"
description = "bar"
}

View File

@ -0,0 +1,3 @@
variable "foo" {
default = "baz"
}