Skip to content

Conversation

@austinvalle
Copy link
Member

Related Issue

Closes #1197
Ref #1211, #1161, #1117

Description

This PR introduces a new plan modifier that implements the same logic as pre-1.15.1 UseStateForUnknown, so it will not preserve null state values, allowing them to stay marked as unknown.

The primary use-case for a plan modifier like this is for use on child-attributes in a nested attribute which will only be preserved once the nested object exists (regardless of whether the resource has been created or not). See #1197 (comment) for a detailed description of the rationale.

While this plan modifier solves the problem more broad then needed, it's also the most accessible/understandable solution for nested attributes of requiring this behavior, since detecting if a parent object exists is not an easy operation (see any issue referencing set identity or their planning 😏 ).


As there were existing providers that may be expecting pre 1.15.1 behavior on UseStateForUnknown, I plan on retroactively updating the 1.15.1 changelog (in this PR) + GH release to reference this behavior change more explicitly.

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.17.0 milestone Nov 21, 2025
@austinvalle austinvalle requested a review from a team as a code owner November 21, 2025 21:58
@austinvalle austinvalle added the enhancement New feature or request label Nov 21, 2025
Copy link
Member Author

@austinvalle austinvalle Nov 21, 2025

Choose a reason for hiding this comment

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

Also updated in the GH release (if we want to change the wording I can re-update 👍🏻 )
https://github.com/hashicorp/terraform-plugin-framework/releases/tag/v1.15.1

It felt weird to update the changelog to reference a future release, so I just mentioned the issue 🙂

Copy link
Member Author

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recent update to UseStateForUnknown causes errors when adding to nested objects

1 participant