crossplane / upjet

A code generation framework and runtime for Crossplane providers
Apache License 2.0
319 stars 89 forks source link

call ApplyTFConversions in Update function from terraform plugin sdk external client #440

Open digna-ionos opened 2 months ago

digna-ionos commented 2 months ago

Not calling ApplyTFConversions in Udate function of tf plugin sdk external client was causing unmarshalling errors for singleton lists.

Description of your changes

add ApplyTFConversions call in Update function, after marshalling json state and before setting the observation.

Fixes https://github.com/crossplane/upjet/issues/438

I have:

How has this code been tested

There are already tests in place for Update function.

mergenci commented 2 months ago

@digna-ionos, Can you share details of your use case that required this change? While I agree that this change is likely to be required, the fact that we haven't hit an issue for so long makes me doubt — and the impact of this change doesn't help relieve my doubt 🙂 I would be happy if you could provide more details. If you could also provide an example manifest that fails before the change and passes after, it would even be better.

digna-ionos commented 1 month ago

@mergenci I've prepared two tests to make it simpler to understand and play with it if you need. https://github.com/crossplane/upjet/commit/9a5726e09448cbb026690a7217b87764dd4e0297#diff-88b92dceed2024799f8225f8778bfc0c159fb2cc590311563721615aa2367ec9