providers/terraform: Always produce correctly-typed result

We need to produce values for all of the attributes implied by our schema,
even if some of them are null.
This commit is contained in:
Martin Atkins 2018-08-28 17:27:59 -07:00
parent 235f582ae5
commit 630b0d147d
1 changed files with 4 additions and 0 deletions

View File

@ -112,6 +112,8 @@ func dataSourceRemoteStateRead(d *cty.Value) (cty.Value, tfdiags.Diagnostics) {
if ws != backend.DefaultStateName { if ws != backend.DefaultStateName {
name = ws name = ws
} }
} else {
newState["workspace"] = cty.NullVal(cty.String)
} }
state, err := b.StateMgr(name) state, err := b.StateMgr(name)
@ -139,6 +141,8 @@ func dataSourceRemoteStateRead(d *cty.Value) (cty.Value, tfdiags.Diagnostics) {
k, v := it.Element() k, v := it.Element()
outputs[k.AsString()] = v outputs[k.AsString()] = v
} }
} else {
newState["defaults"] = cty.NullVal(cty.DynamicPseudoType)
} }
remoteState := state.State() remoteState := state.State()