helper/plugin: Don't panic while preparing response in ApplyResourceChange

This commit is contained in:
Martin Atkins 2018-08-27 16:47:27 -07:00
parent 3d86dc51e0
commit c27f900d92
1 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,8 @@ import (
"errors"
"strconv"
"github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/msgpack"
context "golang.org/x/net/context"
"github.com/hashicorp/terraform/config/hcl2shim"
@ -13,8 +15,6 @@ import (
"github.com/hashicorp/terraform/plugin/convert"
"github.com/hashicorp/terraform/plugin/proto"
"github.com/hashicorp/terraform/terraform"
"github.com/zclconf/go-cty/cty"
"github.com/zclconf/go-cty/cty/msgpack"
)
// NewGRPCProviderServerShim wraps a terraform.ResourceProvider in a
@ -486,7 +486,9 @@ func (s *GRPCProviderServer) ApplyResourceChange(_ context.Context, req *proto.A
resp.Diagnostics = convert.AppendProtoDiag(resp.Diagnostics, err)
return resp, nil
}
resp.NewState.Msgpack = newStateMP
resp.NewState = &proto.DynamicValue{
Msgpack: newStateMP,
}
meta, err := json.Marshal(newInstanceState.Meta)
if err != nil {