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

Is there a way to destroy resources when I delete a folder #2138

Closed
marko-roman opened this issue Jun 9, 2022 · 4 comments
Closed

Is there a way to destroy resources when I delete a folder #2138

marko-roman opened this issue Jun 9, 2022 · 4 comments
Labels

Comments

@marko-roman
Copy link

marko-roman commented Jun 9, 2022

For example i have applayed follow structure
|_envs
|__prod
|__dev

And I want to delete dev. I need firth run terragrunt run-all destroy inside dev folder, and after that delete folder and push to git.
But i want to use CI/CD and destroy resources when i delete dev folder.

Are there any way how to detect that folder was deleting when i run terragrunt run-all apply or plan?

@denis256
Copy link
Member

denis256 commented Jun 10, 2022

Hi,
afaik this is not supported, it will require to remember commit of "last run" calculate diff, identify what is removed and run destroy

@rkhaled0
Copy link

Hi,
I was wondering if there is a way to run a terragrunt run-all plan -destroy in case of terragrunt file deletion.

Any opinions ? @denis256 ?

Copy link

github-actions bot commented Feb 6, 2025

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for raising this issue.

@github-actions github-actions bot added the stale Stale label Feb 6, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2025
@yhakbar
Copy link
Collaborator

yhakbar commented Feb 13, 2025

Hey @rkhaled0 ,

Yes. It's the same solution, and right now has to be done manually unless you're willing to buy a solution like Gruntwork Pipelines, which is designed to handle this logic automatically.

You basically need to checkout the reference where the unit(s) existed, then run plan -destroy/destroy in those units.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants