-
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
states: check root output value changes in refresh-only mode #35812
states: check root output value changes in refresh-only mode #35812
Conversation
…sh mode In refresh-only mode, we do not anticipate proposing any actions; however, a plan is marked as “applyable” if there are changes in the state between runs. Currently, a plan is considered “applyable” only when there are differences in managed resources. This approach seems to overlook changes in root output values. As a result, a plan can be marked as non-applyable, even when there are changes in the root output value, due to the lack of detected changes since only managed resources were checked.
b5e65c7
to
c270e60
Compare
I think I'm okay with this change. Can you get all the tests passing @bschaatsbergen? |
We decided to reject root ephemeral output values as per #35791 so they will not be playing any role in the plan. Ephemeral outputs may only be used internally between nested modules.
The name would suggest they are not but I'm not aware of any particular issues with data sources during |
No, data sources are not considered in the comparison, they only really exist in the state at all for historical reasons and don't need to be refreshed. |
Fixed, 73320c5 |
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
Fixes #35806
In refresh-only mode, we don’t expect to propose any actions, but a plan is marked as “applyable” if there are state changes between runs. Currently, a plan is considered “applyable” only when there are differences in managed resources, which overlooks changes in root output values. As a result, a plan is marked as non-applyable even when the root output values have changed, since only managed resources are being checked.
The states package has an Equal function that checks if two states are deeply equal. While this could solve the issue, it seemed like an overreach, as it focuses on managed resource instances only. To address this, I added a function specifically to detect changes in root output values between states.
It’s also worth noting that output values in other modules don’t persist between runs. Terraform Core tracks these internally, but they aren’t included in any artifacts that persist across executions.
Question for the reviewer: What about ephemeral output values? And, are data sources considered as part of the existing
ManagedResourcesEqual
function already?