pulumi / pulumi-terraform-bridge

A library allowing Terraform providers to be bridged into Pulumi.
Apache License 2.0
194 stars 43 forks source link

DO NOT MERGE: test PlanResourceChange handling of map creates #2063

Closed t0yv0 closed 3 months ago

t0yv0 commented 3 months ago

Noticing that rolling out PlanResourceChange to AWS causes dirty refreshes of the form where "tags" are changing from "null" to "{}".

It appears that what's changed is actually how Creates work, that is {} from Read is fine but null from Create is not. Before PRC we would have Create return tags: {}, but after PRC it returns tags: null instead on a program that does not set tags at all.

Still investigating... it appears that AWS provider does set tags to the empty map but they proceed to disappear in normalizeNullValues:

normalizeNullValues
 dst: cty.MapValEmpty(cty.String)
 src: cty.NullVal(cty.Map(cty.String))
 apply: true
 finval: cty.NullVal(cty.Map(cty.String))

This behavior seems to match TF but in the case of TF this form of dirty refresh is invisible and subsequent terraform apply calls remove the problem.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 61.21%. Comparing base (7677b6e) to head (deb0028). Report is 2 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2063 +/- ## ========================================== - Coverage 61.53% 61.21% -0.33% ========================================== Files 334 337 +3 Lines 45056 45177 +121 ========================================== - Hits 27725 27654 -71 - Misses 15803 16003 +200 + Partials 1528 1520 -8 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

t0yv0 commented 3 months ago

Empty lists and sets affected equally to maps. Not affected curiously if the attribute is Computed :) CC @VenelinMartinov

t0yv0 commented 3 months ago

We wrapped this investigation up in https://github.com/pulumi/pulumi-terraform-bridge/pull/2065