terraform: don't panic on input for bad default type [GH-1344]

This commit is contained in:
Mitchell Hashimoto 2015-04-18 16:31:21 -07:00
parent 897e0f1e45
commit 7a1592ff1e
3 changed files with 29 additions and 0 deletions

View File

@ -175,6 +175,8 @@ func (c *Context) Input(mode InputMode) error {
v := m[n]
switch v.Type() {
case config.VariableTypeUnknown:
continue
case config.VariableTypeMap:
continue
case config.VariableTypeString:

View File

@ -2883,6 +2883,28 @@ func TestContext2Input(t *testing.T) {
}
}
func TestContext2Input_badVarDefault(t *testing.T) {
m := testModule(t, "input-bad-var-default")
p := testProvider("aws")
p.ApplyFn = testApplyFn
p.DiffFn = testDiffFn
ctx := testContext2(t, &ContextOpts{
Module: m,
Providers: map[string]ResourceProviderFactory{
"aws": testProviderFuncFixed(p),
},
})
p.InputFn = func(i UIInput, c *ResourceConfig) (*ResourceConfig, error) {
c.Config["foo"] = "bar"
return c, nil
}
if err := ctx.Input(InputModeStd); err != nil {
t.Fatalf("err: %s", err)
}
}
func TestContext2Input_provider(t *testing.T) {
m := testModule(t, "input-provider")
p := testProvider("aws")

View File

@ -0,0 +1,5 @@
variable "test" {
default {
l = [1, 2, 3]
}
}