config: validate type of default to string or mapping for var
This commit is contained in:
parent
e59ff6e92c
commit
61938c070f
|
@ -108,8 +108,13 @@ func (c *Config) Validate() error {
|
||||||
varMap[v.Name] = v
|
varMap[v.Name] = v
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(mitchellh): Validate that variable defaults are only a string
|
for _, v := range c.Variables {
|
||||||
// or mapping of strings.
|
if v.Type() == VariableTypeUnknown {
|
||||||
|
errs = append(errs, fmt.Errorf(
|
||||||
|
"Variable '%s': must be string or mapping",
|
||||||
|
v.Name))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check for references to user variables that do not actually
|
// Check for references to user variables that do not actually
|
||||||
// exist and record those errors.
|
// exist and record those errors.
|
||||||
|
|
|
@ -73,10 +73,6 @@ func TestConfigValidate_varDefault(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestConfigValidate_varDefaultBadType(t *testing.T) {
|
func TestConfigValidate_varDefaultBadType(t *testing.T) {
|
||||||
t.Skip()
|
|
||||||
|
|
||||||
// TODO(mitchellh): FIX
|
|
||||||
|
|
||||||
c := testConfig(t, "validate-var-default-bad-type")
|
c := testConfig(t, "validate-var-default-bad-type")
|
||||||
if err := c.Validate(); err == nil {
|
if err := c.Validate(); err == nil {
|
||||||
t.Fatal("should not be valid")
|
t.Fatal("should not be valid")
|
||||||
|
|
Loading…
Reference in New Issue