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

Skip imports on tofu destroy #2214

Merged
merged 2 commits into from
Nov 25, 2024
Merged

Conversation

Evi1Pumpkin
Copy link
Contributor

@Evi1Pumpkin Evi1Pumpkin commented Nov 22, 2024

As suggested by @apparentlymart, the tofu destroy command should ignore import blocks. So, this solution skips resolving and expanding import targets when we are running as part of the "preDestroyRefresh" mode.

Resolves #1803

Target Release

1.9.0

Checklist

  • I have read the contribution guide.
  • I have not used an AI coding assistant to create this PR.
  • I have written all code in this PR myself OR I have marked all code I have not written myself (including modified code, e.g. copied from other places and then modified) with a comment indicating where it came from.
  • I (and other contributors to this PR) have not looked at the Terraform source code while implementing this PR.

Go checklist

  • I have run golangci-lint on my change and receive no errors relevant to my code.
  • I have run existing tests to ensure my code doesn't break anything.
  • I have added tests for all relevant use cases of my code, and those tests are passing.
  • I have only exported functions, variables and structs that should be used from other packages.
  • I have added meaningful comments to all exported functions, variables, and structs.

@Evi1Pumpkin Evi1Pumpkin requested a review from a team as a code owner November 22, 2024 22:47
Copy link

Reminder for the PR assignee: If this is a user-visible change, please update the changelog as part of the PR.

apparentlymart
apparentlymart previously approved these changes Nov 22, 2024
Copy link
Contributor

@apparentlymart apparentlymart left a comment

Choose a reason for hiding this comment

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

This approach seems good to me!

cam72cam
cam72cam previously approved these changes Nov 25, 2024
Signed-off-by: Ronny Orot <[email protected]>
@Evi1Pumpkin Evi1Pumpkin merged commit cf34b0e into main Nov 25, 2024
13 checks passed
@Evi1Pumpkin Evi1Pumpkin deleted the fix-1803-skip-imports-on-tofu-destroy branch November 25, 2024 21:52
apparentlymart pushed a commit that referenced this pull request Dec 3, 2024
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.

import block might cause a destroy action to attempt destruction of an already-destroyed resource
3 participants