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

core: do not refresh when forgetting instances #35458

Merged
merged 1 commit into from
Jul 17, 2024
Merged

Conversation

kmoe
Copy link
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.

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 merged commit 5329284 into main Jul 17, 2024
6 checks passed
@kmoe kmoe deleted the kmoe/forget-no-refresh branch July 17, 2024 08:15
Copy link

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
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.

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