-
Notifications
You must be signed in to change notification settings - Fork 46
Preserve sub-resources in state on refresh #4178
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
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
Does the PR have any schema changes?Looking good! No breaking changes found. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4178 +/- ##
==========================================
+ Coverage 58.09% 58.55% +0.46%
==========================================
Files 84 84
Lines 13546 13551 +5
==========================================
+ Hits 7869 7935 +66
+ Misses 5084 5010 -74
- Partials 593 606 +13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I did another round of testing against the repro that was provided in #4145, and confirmed that the issue is reproducable and is corrected by this PR. |
danielrbradley
left a comment
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 revert makes sense that the original change was probably in error due to confusing the need for the empty value when sending to Azure vs needing the value not existing for preserving sub-resources.
Let's add the full repro as an e2e test to ensure this doesn't regress again in the future. This can be added in the provider_e2e_test.go) with the full up, refresh, refresh, up, refresh loop and asserting on the up.Outputs() and the inputs via ExportStack().
|
This PR has been shipped in release v3.5.1. |
1 similar comment
|
This PR has been shipped in release v3.5.1. |
Overview
This PR fixes a regression causing the provider to inadvertently drop the sub-resources following a
pulumi refresh. This leads to flapping attributes as described in #4145, upon a subsequentpulumi upor simply anotherpulumi refresh.The problem manifests only for externally-managed sub-resources (as is generally recommended). For example, a
NetworkSecurityGroupresource with separate (not inline)SecurityRuleresources.In more detail,
refreshcauses two erroneous changes to the checkpointed state of a given sub-resource property (e.g.privateEndpointConnectionsorsecurityRules):[], even if there's a meaningful value (the discovered sub-resources).[], even though the program has no inline resources.From this point, a subsequent
pulumi uporpulumi refreshwill show a spurious change.Closes #4145
Background
This PR essentially reverts some undesirable changes in 642a38b.
In #3054, the Read method was altered to remove sub-resources from the checkpointed state (here). The property map named
outputsWithoutIgnoresseems to have been mistaken to contain outputs, but is best understood as an intermediate form of the inferred inputs, which is why the sub-resources are stripped.PR #3054 also switches from removing to resetting the properties, with the unexpected effect of adding the property into the inputs. This causes flapping in a subsequent
refreshbecause it confusesfindUnsetPropertiesToMaintainto think that the sub-resources are inline.I believe that #3054 was effective at solving #3049 because it incorporated Mikhail's insight about the SDK shape, here. The changes that we now seek to revert were not germane to #3049.
Example 1
Deploy the following program twice, setting the
revisiontag to2after the first deployment. Twice is needed because this program creates an security rule within the NSG, but the NSG's state will not reflect the security rule until after an update to the NSG. Refresh would not be effective because that's the very problem this PR seeks to fix.Export the state, run
pulumi refresh, and export again. You should observe that the NSG's inputs and outputs have been destabilized. Try refreshes and ups to see flapping.See attachments, for a series of state exports:
Example 2
This example is closer to what's described in #4145. The program creates a private endpoint, so that the EventHub namespace has a private endpoint connection that we may observe to be 'flappy'.
repro.zip