Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty value for a block or a map in forProvider causes a panic #419

Open
villevsv-upcloud opened this issue Jun 30, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@villevsv-upcloud
Copy link

villevsv-upcloud commented Jun 30, 2024

What happened?

Preparing the diff plan response will cause a panic, if the diff.Value1 for a path is nil.

How can we reproduce it?

  1. Apply a resource with non-empty values for block or map fields.
  2. 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.

Related omitempty issue: crossplane-contrib/provider-upjet-aws#1357

@villevsv-upcloud villevsv-upcloud added the bug Something isn't working label Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant