Skip to content

Fix resource identity being dropped from state in certain cases#37396

Merged
dbanck merged 5 commits intomainfrom
dbanck/identity-apply-error
Aug 5, 2025
Merged

Fix resource identity being dropped from state in certain cases#37396
dbanck merged 5 commits intomainfrom
dbanck/identity-apply-error

Conversation

@dbanck
Copy link
Copy Markdown
Member

@dbanck dbanck commented Aug 4, 2025

This PR resolves two issues where Terraform was incorrectly removing resource identity information from the state during apply.

  1. When an error occurs during an destroy operation and the provider returns a new non-null value for the state, the resource identity from the provider response wasn't included in the new state.

  2. When the state values don't change during an update operation, but the marks (e.g. sensitive) do. In this case, Terraform doesn't communicate with the provider and simply updates the state. The resource identity information was also missing in that case.

Target Release

1.13.0

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

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

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

@dbanck dbanck added no-changelog-needed Add this to your PR if the change does not require a changelog entry 1.13-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Aug 4, 2025
@dbanck dbanck removed the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Aug 4, 2025
@dbanck dbanck force-pushed the dbanck/identity-apply-error branch from 131b5a3 to 242a95f Compare August 4, 2025 16:06
@dbanck dbanck changed the title Fix identity being dropped from state when destroy fails Fix resource identity being dropped from state in certain cases Aug 4, 2025
@dbanck dbanck marked this pull request as ready for review August 4, 2025 16:26
@dbanck dbanck requested a review from a team as a code owner August 4, 2025 16:27
@dbanck dbanck merged commit 28cb130 into main Aug 5, 2025
14 checks passed
@dbanck dbanck deleted the dbanck/identity-apply-error branch August 5, 2025 10:00
@dbanck dbanck added 1.13-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged and removed 1.13-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Aug 5, 2025
dbanck added a commit that referenced this pull request Aug 5, 2025
* Test case for keeping identity on destroy error

* Add identity to resource instance object on error

* Add changelog

* Test case for keeping identity on update without changes

* Add identity to resource instance object on udpate
dbanck added a commit that referenced this pull request Aug 5, 2025
…) (#37402)

* Test case for keeping identity on destroy error

* Add identity to resource instance object on error

* Add changelog

* Test case for keeping identity on update without changes

* Add identity to resource instance object on udpate
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Sep 5, 2025

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.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

1.13-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants