don't allow EvalWriteState without a provider

This commit is contained in:
James Bardin 2018-12-18 13:09:40 -05:00
parent 06a75b8038
commit e73a8bb627
1 changed files with 4 additions and 0 deletions

View File

@ -212,6 +212,10 @@ func (n *EvalWriteState) Eval(ctx EvalContext) (interface{}, error) {
absAddr := n.Addr.Absolute(ctx.Path())
state := ctx.State()
if n.ProviderAddr.ProviderConfig.Type == "" {
return nil, fmt.Errorf("failed to write state for %s, missing provider type", absAddr)
}
obj := *n.State
if obj == nil || obj.Value.IsNull() {
// No need to encode anything: we'll just write it directly.