Skip to content
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

Validate write-only attributes returned from providers during the UpgradeResourceState RPC #36305

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Jan 10, 2025

This PR add validation to ensure providers don't return values for write-only attributes during UpgradeResourceState. Terraform core doesn't know if a provider has been updated since the last time the state was updated, and this RPC allows providers to upgrade state to match any schema changes for a particular resource.

The relevant changes for WO attributes are:

  1. A field has been changed to become write-only
  2. A field has changed to stop being write-only

In case number 2 there is no concern. The state will contain null from when the field was write-only, and then the provider may return a new non-null value on state upgrade.

For case number 1 we don't want a value to be returned to TF core. That is what this PR's changes protects against.

Target Release

1.11.x

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@SarahFrench SarahFrench marked this pull request as ready for review January 10, 2025 18:25
@SarahFrench SarahFrench requested a review from a team as a code owner January 10, 2025 18:25
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.

2 participants