# Computed Object produces error when creating resource (custom provider using framework)

**URL:** <https://discuss.hashicorp.com/t/computed-object-produces-error-when-creating-resource-custom-provider-using-framework/30727>\
**Category:** Terraform Providers\
**Created:** [October 14, 2021, 3:33pm UTC](https://discuss.hashicorp.com/t/computed-object-produces-error-when-creating-resource-custom-provider-using-framework/30727 "2021-10-14T15:33:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![srrasero](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/srrasero/32/21759_2.png) [@srrasero](https://discuss.hashicorp.com/u/srrasero)\
**Post date:** [October 14, 2021, 3:33pm UTC](https://discuss.hashicorp.com/t/computed-object-produces-error-when-creating-resource-custom-provider-using-framework/30727/1 "2021-10-14T15:33:55Z")

</div>

Programming a custom provider with the Framework, I am having a problem with a Computed: true object. The definition in the schema is this:

“limits”: {  
Computed: true,  
Type: types.ObjectType{  
AttrTypes: map[string]attr.Type{  
“a”: types.StringType,  
“b”: types.StringType,  
“c”: types.StringType,  
“d”: types.StringType,  
},  
},  
},

The tf file does not include that parameter, obviously. And when I execute the plan, everything is ok. But when I apply it , I receive this error, that occurs when getting the plan (diags := req.Plan.Get(ctx, &plan)):

" _An unexpected error was encountered trying to build a value. This is always an error in the provider. Please report the following to the provider developer:_  
\*│ \*  
_│ unhandled unknown value_"

I do not understand why I am getting this error. The object is Computed, so it is supposed to be unknown until the apply takes place.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![srrasero](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/srrasero/32/21759_2.png) [@srrasero](https://discuss.hashicorp.com/u/srrasero)\
**Post date:** [October 15, 2021, 6:36am UTC](https://discuss.hashicorp.com/t/computed-object-produces-error-when-creating-resource-custom-provider-using-framework/30727/2 "2021-10-15T06:36:53Z")

</div>

Just for the record. There are more attributes included that have Computed: true. But it is only the Object attribute that causes problems.  
For now, I am going to avoid the req.Plan.Get(ctx, &plan) and will get the attributes with req.Plan.GetAttribute. Except if I receive an answer here that makes some light 🙂

---

<div class="post-metadata">

**Author:** ![srrasero](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/srrasero/32/21759_2.png) [@srrasero](https://discuss.hashicorp.com/u/srrasero)\
**Post date:** [October 15, 2021, 7:26am UTC](https://discuss.hashicorp.com/t/computed-object-produces-error-when-creating-resource-custom-provider-using-framework/30727/3 "2021-10-15T07:26:33Z")

</div>

Ok. I found this warning:

“_Warning: It can be tempting to use Go types instead of `attr.Value` implementations when the provider doesn’t care about the distinction between an empty value, unknown, and null. But if Terraform has a null or unknown value and the provider asks the framework to store it in a type that can’t hold it, `Get` will return an error. Make sure the types you are using can hold the values they might contain! An opt-in conversion of null or unknown values to the empty value is coming in the future._”

Until that opt-in conversion of null or, specially, unknow values to the empty value, we will have to get every value separately.

Thanks anyway. Hope this helps someone.
