Closed mdmohan closed 2 months ago
Hey there @mdmohan 👋🏻 , I believe the fixes introduced in #161 should address the behavior you're seeing from ToObjectValue
.
Try regenerating your resource code with v0.4.1
and let us know if that fixes your data consistency error.
tfplugingen-framework CLI version
v0.4.0
Provider Code Spec File
Schema Generated
Expected Behavior
In this given resource the attribute
custom_attributes_nested_map
is markedoptional
as its not used always. Expecting the attributecustom_attributes_nested_map
to contain valid key-value pairs or it can be empty. Facing a problem whencustom_attributes_nested_map
is left empty and not mentioned in config fileSample config
Expecting the plan to be successful with an empty/null map generated for
custom_attributes_nested_map
as it isoptional
Actual Behavior
Planning failed.
Terraform expects
MapNull
but it getsMapValEmpty
(This is coming fromToObjectValue
in generated code)Additional Information
Work around
1) Specify an empty
custom_attributes_nested_map
or 2) Change the attribute
custom_attributes_nested_map
tooptional_computed
Possible Solution:
This can be solved if the generated function
func (v ParameterMapValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
can set
custom_attributes_nested_map
tomapNull
if the map is empty instead of creating an returning an empty map.Kindly suggest if
ToObjectValue
can be modified to return MapNull in this situation or need to flag this to terraform as an inconsistency issue.Code of Conduct