Apply a resource with non-empty values for block or map fields.
Updating the resource with empty values such as [] and {} will cause a panic.
This is most likely related to the way the diff in terraform-plugin-go seems to work, but also how the library handles empty values when marshaling to msgpack.
Using a forked version of upjet repo with a small change made to the external_tfpluginfw.go:282 seems to mitigate the issue:
if diff.Value1 != nil && diff.Value1.IsKnown() && !diff.Value1.IsNull() {
In addition, deleting the resource with also cause some troubles, if the field with the empty value is marked as required.
What happened?
Preparing the diff plan response will cause a panic, if the
diff.Value1
for a path isnil
.How can we reproduce it?
[]
and{}
will cause a panic.This is most likely related to the way the diff in
terraform-plugin-go
seems to work, but also how the library handles empty values when marshaling to msgpack.Using a forked version of
upjet
repo with a small change made to the external_tfpluginfw.go:282 seems to mitigate the issue:In addition, deleting the resource with also cause some troubles, if the field with the empty value is marked as required.
Related
omitempty
issue: https://github.com/crossplane-contrib/provider-upjet-aws/issues/1357