Skip to content

internal/fwserver: Move write-only nullification to earlier in PlanResourceChange #1097

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

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

SBGoods
Copy link
Contributor

@SBGoods SBGoods commented Feb 19, 2025

Fixes: #1096

During PlanResourceChange, computed attributes that are null in the configuration are marked as unknown. This logic only runs when there is a non-null planned state and the planned state is not equal to the prior state. If a write-only attribute is set in config, then the prior state (which is always null) and planned state (which contains the config value) will always differ causing null computed values to always be marked as unknown instead of using the prior value. This causes perpetual diffs after resource creation if a write-only attribute is set in config and the resource has non-null computed attribute values in state.

The fix moves the write-only value nullification for the planned state to happen before this check.

@SBGoods SBGoods marked this pull request as ready for review February 19, 2025 20:30
@SBGoods SBGoods requested a review from a team as a code owner February 19, 2025 20:30
@austinvalle austinvalle added this to the v1.14.1 milestone Feb 19, 2025
Copy link
Member

@austinvalle austinvalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, would like to see this change run against the new corner provider tests before we release the next version 🚀

@SBGoods SBGoods merged commit 3000d8c into main Feb 19, 2025
34 checks passed
@SBGoods SBGoods deleted the SBGoods/write-only-plan-modification-fix branch February 19, 2025 21:19
@magodo
Copy link

magodo commented Feb 19, 2025

Thanks @SBGoods for the instant fix! @austinvalle I can confirm this solved my issue #1096. I'll continue developing my provider and report new issues if any.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write-only dynamic attribute causes plan diff everytime
3 participants