Recommended guideline to change attribute from optional + computed to optional in the resource

Hello Team,

is there any guideline for changing attribute from optional + computed to optional only? And adding new separate field which will as computed.

Hi @thakkarkrunal820,

When using “optional” and “computed” together, the rule is that if the module author assigned a value to the argument then the provider must use that value, but if the author left it unassigned (or, equivalently, set it to null) then the provider may choose any value of the declared type.

Removing “computed” while keeping “optional” modifies that rule: the treatment of an argument actually specified is the same, but when the argument is not specified the provider must keep it as null.

In other words, an optional+computed attribute whose default chosen by the provider is null is effectively equivalent to an attribute with only optional set. The difference is only whether the provider is deciding to return null dynamically or whether that’s declared statically as part of the schema.

I’m not sure if this really answers your question, because this is “a guideline” but might not be guidance that is useful for your goal. If this hasn’t helped, I suggest asking a more specific question. It would help to mention what you’ve tried already, how that behaved, and (if applicable) what you had wanted to happen instead.


there are guidelines if we are deprecating the attribute. similarly, is there an any guideline for making attribute as optional from optional/computed or we just have to document this?