Skip to content

core: do not refresh when forgetting instances#35458

Merged
kmoe merged 1 commit intomainfrom
kmoe/forget-no-refresh
Jul 17, 2024
Merged

core: do not refresh when forgetting instances#35458
kmoe merged 1 commit intomainfrom
kmoe/forget-no-refresh

Conversation

@kmoe
Copy link
Copy Markdown
Member

@kmoe kmoe commented Jul 15, 2024

Fixes #35436

When destroying a resource instance, we always refresh first, to give the provider a chance to tell us that the instance no longer exists. This prevents issues with providers that cannot handle delete requests for already deleted resources.

When forgetting, however, this is unnecessary, since no further requests to the provider will be made for this instance. Indeed, since a main use case for the forget functionality is removing instances from state for which there is no longer a configurable provider, attempting to refresh is both unnecessary and often problematic.

@kmoe kmoe requested a review from a team July 15, 2024 15:19
When destroying a resource instance, we always refresh first, to give
the provider a chance to tell us that the instance no longer exists.
This prevents issues with providers that cannot handle delete requests
for already deleted resources.

When forgetting, however, this is unnecessary, since no further requests
to the provider will be made for this instance. Indeed, since a main use
case for the forget functionality is removing instances from state for
which there is no longer a configurable provider, attempting to refresh
is both unnecessary and often problematic.
@kmoe kmoe force-pushed the kmoe/forget-no-refresh branch from 39a6c8c to 461f276 Compare July 15, 2024 15:38
@kmoe kmoe merged commit 5329284 into main Jul 17, 2024
@kmoe kmoe deleted the kmoe/forget-no-refresh branch July 17, 2024 08:15
@github-actions
Copy link
Copy Markdown
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

kmoe added a commit that referenced this pull request Jul 17, 2024
…ces (#35467)

* core: do not refresh when forgetting instances

When destroying a resource instance, we always refresh first, to give
the provider a chance to tell us that the instance no longer exists.
This prevents issues with providers that cannot handle delete requests
for already deleted resources.

When forgetting, however, this is unnecessary, since no further requests
to the provider will be made for this instance. Indeed, since a main use
case for the forget functionality is removing instances from state for
which there is no longer a configurable provider, attempting to refresh
is both unnecessary and often problematic.

* update changelog
@github-actions
Copy link
Copy Markdown
Contributor

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 Aug 17, 2024
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.

removed blocks do not cover all use cases of terraform state rm

2 participants