-
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
More unknowns tests for diff #2140
Conversation
+ prov:index/test:Test: (create) | ||
[urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] | ||
tests : [ | ||
[0]: {} |
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.
this is an unknown array
[urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] | ||
~ tests: [ | ||
~ [0]: { | ||
- testProp: "known_val" |
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.
The new value is unknown - this just shows us removing the old value.
[urn=urn:pulumi:test::test::prov:index/nestedTest:NestedTest::mainRes] | ||
~ tests: [ | ||
~ [0]: { | ||
- nestedProps: [ |
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.
The diff here is duplicated?
tests : [ | ||
[0]: { | ||
nestedProps: [ | ||
[0]: {} |
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.
Unknown array shown as just an array with a single empty object
~ [0]: { | ||
~ nestedProps: [ | ||
~ [0]: { | ||
- testProps: [ |
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.
duplicated diff again
~ nestedProps: [ | ||
~ [0]: { | ||
~ testProps: [ | ||
~ [0]: "known_val" => output<string> |
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.
unknown at the wrong level
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2140 +/- ##
==========================================
- Coverage 60.64% 60.63% -0.01%
==========================================
Files 350 350
Lines 45898 45898
==========================================
- Hits 27833 27829 -4
- Misses 16526 16529 +3
- Partials 1539 1540 +1 ☔ View full report in Codecov by Sentry. |
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.
LGTM
This PR has been shipped in release v3.86.0. |
This changes the bridge to correctly return unknowns for objects and collections in sdkv2. fixes #1885 fixes #2032 stacked on #2158 Confirmed that TF sdkv2 supports both unknown blocks and unknown collections of blocks, so we should be fine to pass these into TF providers. The TF sdkv1 does not support unknowns for blocks and collections so we keep the old behaviour of passing empty/ collection of unknown. <details> ```hcl provider "google" { region = "us-central1" } resource "google_storage_bucket" "bucket" { name = "example-bucket12312322312" location = "US" } resource "google_storage_bucket" "bucket1" { name = "example-bucket123123223" location = "US" dynamic "lifecycle_rule" { for_each = google_storage_bucket.bucket.effective_labels content { action { type = lifecycle_rule.value } condition { age = 1 } } } } ``` </details> This returns `"lifecycle_rule":cty.UnknownVal(cty.List(cty.Object))` Our handling of collections containing unknowns and unknown collections is significantly better: Unknown collections: before: ``` + prov:index/test:Test: (create) [urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] tests : [ [0]: {} ] ``` after: ``` + prov:index/test:Test: (create) [urn=urn:pulumi:test::test::prov:index/test:Test::mainRes] tests : output<string> ``` Note that the array being output as an `output<string>` is an engine limitation. Nested unknown collections: before: ``` + prov:index/nestedTest:NestedTest: (create) [urn=urn:pulumi:test::test::prov:index/nestedTest:NestedTest::mainRes] tests : [ [0]: { nestedProps: [ [0]: { testProps : [ [0]: output<string> ] } ] } ] ``` after: ``` + prov:index/nestedTest:NestedTest: (create) [urn=urn:pulumi:test::test::prov:index/nestedTest:NestedTest::mainRes] tests : [ [0]: { nestedProps: [ [0]: { testProps : output<string> } ] } ] ``` The unknown was being put one level lower than it should be. Quite a few other very wrong outputs in #2140, including diff duplications, missing diffs etc.
This separates the tests from #2061 to make the effect of the changes obvious.
The tests mostly focus around the way unknowns are displayed in diffs.
Some of the outputs here are very clearly wrong. I've annotated most of them but they are all fixed in 2061