mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-16 18:35:03 -06:00
Merge pull request #19250 from hashicorp/f-inputs
Fix the ability to ask for and save user input
This commit is contained in:
commit
643fccc923
@ -869,7 +869,7 @@ func (m *Meta) backendInitFromConfig(c *configs.Backend) (backend.Backend, cty.V
|
|||||||
b := f()
|
b := f()
|
||||||
|
|
||||||
schema := b.ConfigSchema()
|
schema := b.ConfigSchema()
|
||||||
decSpec := schema.DecoderSpec()
|
decSpec := schema.NoneRequired().DecoderSpec()
|
||||||
configVal, hclDiags := hcldec.Decode(c.Config, decSpec, nil)
|
configVal, hclDiags := hcldec.Decode(c.Config, decSpec, nil)
|
||||||
diags = diags.Append(hclDiags)
|
diags = diags.Append(hclDiags)
|
||||||
if hclDiags.HasErrors() {
|
if hclDiags.HasErrors() {
|
||||||
|
@ -231,12 +231,10 @@ func (m *Meta) inputForSchema(given cty.Value, schema *configschema.Block) (cty.
|
|||||||
return given, nil
|
return given, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
givenVals := given.AsValueMap()
|
retVals := given.AsValueMap()
|
||||||
retVals := make(map[string]cty.Value, len(givenVals))
|
|
||||||
names := make([]string, 0, len(schema.Attributes))
|
names := make([]string, 0, len(schema.Attributes))
|
||||||
for name, attrS := range schema.Attributes {
|
for name, attrS := range schema.Attributes {
|
||||||
retVals[name] = givenVals[name]
|
if attrS.Required && retVals[name].IsNull() && attrS.Type.IsPrimitiveType() {
|
||||||
if givenVal := givenVals[name]; attrS.Required && givenVal.IsNull() && attrS.Type.IsPrimitiveType() {
|
|
||||||
names = append(names, name)
|
names = append(names, name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user