helper/schema: don't ask for input on fields that have a value
This commit is contained in:
parent
5b0859b3f5
commit
d9596fa4d0
|
@ -282,6 +282,11 @@ func (m schemaMap) Input(
|
|||
continue
|
||||
}
|
||||
|
||||
// Skip things that have a value of some sort already
|
||||
if _, ok := c.Raw[k]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
var value interface{}
|
||||
var err error
|
||||
switch v.Type {
|
||||
|
|
|
@ -1055,10 +1055,6 @@ func TestSchemaMap_Input(t *testing.T) {
|
|||
},
|
||||
},
|
||||
|
||||
Config: map[string]interface{}{
|
||||
"availability_zone": "bar",
|
||||
},
|
||||
|
||||
Input: map[string]string{
|
||||
"availability_zone": "foo",
|
||||
},
|
||||
|
@ -1069,9 +1065,36 @@ func TestSchemaMap_Input(t *testing.T) {
|
|||
|
||||
Err: false,
|
||||
},
|
||||
|
||||
{
|
||||
Schema: map[string]*Schema{
|
||||
"availability_zone": &Schema{
|
||||
Type: TypeString,
|
||||
Optional: true,
|
||||
},
|
||||
},
|
||||
|
||||
Config: map[string]interface{}{
|
||||
"availability_zone": "bar",
|
||||
},
|
||||
|
||||
Input: map[string]string{
|
||||
"availability_zone": "foo",
|
||||
},
|
||||
|
||||
Result: map[string]interface{}{
|
||||
"availability_zone": "bar",
|
||||
},
|
||||
|
||||
Err: false,
|
||||
},
|
||||
}
|
||||
|
||||
for i, tc := range cases {
|
||||
if tc.Config == nil {
|
||||
tc.Config = make(map[string]interface{})
|
||||
}
|
||||
|
||||
c, err := config.NewRawConfig(tc.Config)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
|
|
Loading…
Reference in New Issue