Skip to content

Conversation

austinvalle
Copy link
Member

Related Issue

Closes #1117

Description

This PR adjusts all of the UseStateForUnknown plan modifiers to also preserve null state values (which are technically known). The original logic was excluding all null state values although we believe the intended behavior was to skip when creating resources (which should be checking the resource instance state for null, not the specific state value).

Note

One of the impacts of fixing this bug would be any attributes in existing resource implementations that are relying on null values being set to unknown during update plans, which would now start to preserve the prior state (keeping null), so if the provider is not preserving those prior state values during apply, it could cause data consistency issues if that unknown marking was being relied on.

Off the top of my head, I'm not sure why you'd use UseStateForUnknown in this way, since the goal of this plan modifier has always been to denote an attribute that doesn't change during apply on updates. Fixing this bug doesn't change that goal, it just makes it more precise.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

No

@austinvalle austinvalle added this to the v1.16.0 milestone Jun 12, 2025
@austinvalle austinvalle requested a review from a team as a code owner June 12, 2025 15:53
Copy link
Member Author

Choose a reason for hiding this comment

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

The changes to this test and internal/fwserver/block_plan_modification_test.go were just to ensure the intended behavior was still tested, as the original tests did not actually set up the req.State value properly 😄

Copy link
Contributor

@bbasata bbasata left a comment

Choose a reason for hiding this comment

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

:shipit: :shipit: :shipit:

@austinvalle austinvalle force-pushed the av/fix-use-state-for-unknown branch from 4d499e4 to e772d51 Compare July 15, 2025 13:06
@austinvalle austinvalle merged commit c83bd4e into main Jul 15, 2025
37 checks passed
@austinvalle austinvalle deleted the av/fix-use-state-for-unknown branch July 15, 2025 13:25
austinvalle added a commit that referenced this pull request Jul 31, 2025
…l state values (#1161)

* apply fix to string plan modifier and shared tests

* sets

* list

* map

* object

* numbers, floats, and ints

* bool

* dynamics

* add changelog
austinvalle added a commit that referenced this pull request Jul 31, 2025
…l state values (#1161) (#1194)

* apply fix to string plan modifier and shared tests

* sets

* list

* map

* object

* numbers, floats, and ints

* bool

* dynamics

* add changelog
@austinvalle austinvalle modified the milestones: v1.16.0, v1.15.1 Jul 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UseStateForUnknown doesn't preserve known null prior state values
2 participants