Skip to content

Skip imports on tofu destroy#2214

Merged
Evi1Pumpkin merged 2 commits into
mainfrom
fix-1803-skip-imports-on-tofu-destroy
Nov 25, 2024
Merged

Skip imports on tofu destroy#2214
Evi1Pumpkin merged 2 commits into
mainfrom
fix-1803-skip-imports-on-tofu-destroy

Conversation

@Evi1Pumpkin
Copy link
Copy Markdown
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.

Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
@Evi1Pumpkin Evi1Pumpkin requested a review from a team as a code owner November 22, 2024 22:47
@github-actions
Copy link
Copy Markdown

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
Copy Markdown
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 <ronny.orot@gmail.com>
@Evi1Pumpkin Evi1Pumpkin merged commit cf34b0e into main Nov 25, 2024
@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
Signed-off-by: Ronny Orot <ronny.orot@gmail.com>
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