config: test for var uniqueness in overrides
This commit is contained in:
parent
fbf06e2a59
commit
0fceeaaeb0
|
@ -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
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
variable "foo" {
|
||||
default = "bar"
|
||||
description = "bar"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
variable "foo" {
|
||||
default = "baz"
|
||||
}
|
Loading…
Reference in New Issue