terraform: don't panic on input for bad default type [GH-1344]
This commit is contained in:
parent
897e0f1e45
commit
7a1592ff1e
|
@ -175,6 +175,8 @@ func (c *Context) Input(mode InputMode) error {
|
||||||
|
|
||||||
v := m[n]
|
v := m[n]
|
||||||
switch v.Type() {
|
switch v.Type() {
|
||||||
|
case config.VariableTypeUnknown:
|
||||||
|
continue
|
||||||
case config.VariableTypeMap:
|
case config.VariableTypeMap:
|
||||||
continue
|
continue
|
||||||
case config.VariableTypeString:
|
case config.VariableTypeString:
|
||||||
|
|
|
@ -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) {
|
func TestContext2Input_provider(t *testing.T) {
|
||||||
m := testModule(t, "input-provider")
|
m := testModule(t, "input-provider")
|
||||||
p := testProvider("aws")
|
p := testProvider("aws")
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
variable "test" {
|
||||||
|
default {
|
||||||
|
l = [1, 2, 3]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue