-
Notifications
You must be signed in to change notification settings - Fork 43
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
DO NOT MERGE: test PlanResourceChange handling of map creates #2063
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ 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 ☔ View full report in Codecov by Sentry. |
Empty lists and sets affected equally to maps. Not affected curiously if the attribute is Computed :) CC @VenelinMartinov |
CreateContext: func(ctx context.Context, rd *schema.ResourceData, i interface{}) sdkdiag.Diagnostics { | ||
rd.SetId("id0") | ||
if tc.doSetTags { | ||
rd.Set("tags", tc.createTagsAs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit confused about this - shouldn't Create only be allowed to set Computed properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an excellent point. I think that's exactly right documentation wise, but apparently this property is not enforced by the framework. The bridge is doing something really special because we changed how tags property work to remove Computed=true from the original upstream. I can confirm however that tagsInterceptor does in fact call rd.Set() in the bridge. And that seems to take effect and work.
We wrapped this investigation up in #2065 |
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 returnstags: 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:
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.