-
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
Remove spurious ConflictsWith warnings on import #1948
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1948 +/- ##
==========================================
+ Coverage 60.51% 62.41% +1.89%
==========================================
Files 329 329
Lines 44477 37056 -7421
==========================================
- Hits 26917 23127 -3790
+ Misses 16050 12418 -3632
- Partials 1510 1511 +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.
I'd like some more testing on different conflicts with topologies, but otherwise I think this looks good.
pkg/tfbridge/deconflict_test.go
Outdated
schema := &schema.SchemaMap{ | ||
"availability_zone": (&schema.Schema{ | ||
Type: shim.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
ConflictsWith: []string{"availability_zone_id"}, | ||
}).Shim(), | ||
"availability_zone_id": (&schema.Schema{ | ||
Type: shim.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
ConflictsWith: []string{"availability_zone"}, | ||
}).Shim(), | ||
} |
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.
Can you add a test for different ConflictsWith topologies?
At the very least:
A conflicts with B (where B does not conflict with A)
A conflicts with B and C, B conflicts with A and C, C conflicts with A and B
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.
Yeah good point, adding a few.
Toward #1225 - this fixes the special case of ConflictsWith warnings. This fixes spurious warnings on
pulumi import
, popular bugs such as:TF does not guarantee Read results to be compatible with calling Check on, in particular Read can return results that run afoul of ConflictsWith constraint. This change compensates by arbitrarily dropping data from the Read result until it passes ConflictsWith checks.
This affects
pulumi refresh
as well as I think it should although I have not seen "in the wild" cases where refresh is affected, since it typically will not copy these properties to the input bag unless they're present in old inputs, which are usually correct wrt to ConflictsWith.