Skip to content

Commit

Permalink
plugin/pluginapi/v1: fix cty decoding (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
dobarx authored Jun 18, 2024
1 parent b3b92a3 commit 750cc4e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin/pluginapi/v1/cty_value_decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func decodeCtyValue(src *CtyValue) (cty.Value, error) {
return cty.NilVal, err
}
switch {
case t.IsPrimitiveType() && src.GetPrimitive() != nil:
case t.IsPrimitiveType():
return decodeCtyPrimitiveValue(src.GetPrimitive())
case t.IsObjectType() || t.IsMapType():
return decodeCtyMapLike(t, src.GetMapLike().GetElements())
Expand Down Expand Up @@ -83,6 +83,9 @@ func decodeCtyListLike(t cty.Type, src []*CtyValue) (cty.Value, error) {
}

func decodeCtyPrimitiveValue(src *CtyPrimitiveValue) (cty.Value, error) {
if src == nil {
return cty.NilVal, nil
}
switch data := src.GetData().(type) {
case *CtyPrimitiveValue_Bln:
return cty.BoolVal(data.Bln), nil
Expand Down

0 comments on commit 750cc4e

Please sign in to comment.