Fix the ability to ask for and save user input

This commit is contained in:
Sander van Harmelen 2018-11-01 19:59:07 +01:00
parent af50f0e228
commit 5944e8e34f
2 changed files with 3 additions and 5 deletions

View File

@ -869,7 +869,7 @@ func (m *Meta) backendInitFromConfig(c *configs.Backend) (backend.Backend, cty.V
b := f()
schema := b.ConfigSchema()
decSpec := schema.DecoderSpec()
decSpec := schema.NoneRequired().DecoderSpec()
configVal, hclDiags := hcldec.Decode(c.Config, decSpec, nil)
diags = diags.Append(hclDiags)
if hclDiags.HasErrors() {

View File

@ -231,12 +231,10 @@ func (m *Meta) inputForSchema(given cty.Value, schema *configschema.Block) (cty.
return given, nil
}
givenVals := given.AsValueMap()
retVals := make(map[string]cty.Value, len(givenVals))
retVals := given.AsValueMap()
names := make([]string, 0, len(schema.Attributes))
for name, attrS := range schema.Attributes {
retVals[name] = givenVals[name]
if givenVal := givenVals[name]; attrS.Required && givenVal.IsNull() && attrS.Type.IsPrimitiveType() {
if attrS.Required && retVals[name].IsNull() && attrS.Type.IsPrimitiveType() {
names = append(names, name)
}
}