Skip to content
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

Merged
merged 7 commits into from
May 9, 2024

Conversation

t0yv0
Copy link
Member

@t0yv0 t0yv0 commented May 9, 2024

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.

Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 96.87500% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 62.41%. Comparing base (fa1796a) to head (5ce1eda).
Report is 1 commits behind head on master.

Files Patch % Lines
pkg/tfbridge/deconflict.go 96.77% 1 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

@t0yv0 t0yv0 changed the title Remove spurious warnings on import Remove spurious ConflictsWith warnings on import May 9, 2024
@t0yv0 t0yv0 marked this pull request as ready for review May 9, 2024 19:40
Copy link
Member

@iwahbe iwahbe left a 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.

Comment on lines 33 to 48
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(),
}
Copy link
Member

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

Copy link
Member Author

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.

@t0yv0 t0yv0 enabled auto-merge (squash) May 9, 2024 21:08
@t0yv0 t0yv0 merged commit 6814027 into master May 9, 2024
11 checks passed
@t0yv0 t0yv0 deleted the t0yv0/deconflict-read-results branch May 9, 2024 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants