-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Stored dependency handling during plan #28228
Conversation
missing CreateBeforeDestroy
A stored dependency is documented as being honored even after it is removed from the configuration, until the referenced resource is destroyed.
The resource configuration was always being used to determine dependencies during refresh, because if there were no changes to a resource, there was no chance to replace any incorrect stored dependencies. Now that we are refreshing during plan, we can determine that a resource has no changes and opt to store the new dependencies immediately. Here we clean up the writeResourceInstanceState calls to no longer modify the resource instance state, removing the `dependencies` argument. Callers are now expected to set the Dependencies field as needed.
Codecov Report
|
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 makes sense to me!
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
The current configuration was always being used to determine dependencies during refresh, because if there were no changes to a resource, there was no chance to replace any incorrect stored dependencies. Always refreshing dependencies prevented situations that required manual state manipulation while refactoring complex configurations.
The problem this caused however, was that dependencies to resources which had been removed from the configuration but not yet destroy were not being handled in the correct order. To handle orphaned dependencies, they must be maintained in the refreshed state all the way through apply. Now that we are refreshing during plan, we can always merge all the known dependencies (invalid dependency targets are not an error, they are ignored), and only if there is no change to the resource will the current config dependencies be stored immediately.
We can also clean up the
writeResourceInstanceState
calls to no longer modify the resource instance state argument, and remove thedependencies
argument. Callers are now expected to set theDependencies
field as needed.Fixes #28193