fix: unused config's create_before_destroy on resource change with no refresh#2248
Merged
fix: unused config's create_before_destroy on resource change with no refresh#2248
Conversation
|
Reminder for the PR assignee: If this is a user-visible change, please update the changelog as part of the PR. |
1fed782 to
dffe0d5
Compare
… refresh Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: ollevche <ollevche@gmail.com>
Signed-off-by: ollevche <ollevche@gmail.com>
0eb2dc6 to
0f64413
Compare
apparentlymart
approved these changes
Dec 19, 2024
Contributor
apparentlymart
left a comment
There was a problem hiding this comment.
This seems plausible! 👍
Having another weird special case makes me a little nervous, but it's at least relatively self-contained and I don't really have a better idea for how to do this with how the code is currently structured.
ollevche
added a commit
that referenced
this pull request
Dec 20, 2024
… refresh (#2248) Signed-off-by: ollevche <ollevche@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR I add an additional refresh state write on planning even when
refresh=falseis used, since this is the place where we synchronize configurationcreate_before_destroyvalue with the state itself. As discussed in the issue, we only write to the refreshed state for this specific use case (refresh=false+ configuration value present + state value differs).Note: I didn't alter the logic of
create_before_destroyitself, however I suspect there could be a problem for cases when OpenTofu needs to use state's value (inherited) when replacing a resource even if the configuration doesn't force cbd anymore. Not sure if that's a practical problem though.Also, I removed a few unused params, which I encountered during debugging. This is irrelevant to the PR, however those are pretty small changes.
Resolves #1806
Target Release
1.9.0
Checklist
Go checklist