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

Support atlantis destroy subcommand #941

Open
YesYouKenSpace opened this issue Mar 5, 2020 · 14 comments
Open

Support atlantis destroy subcommand #941

YesYouKenSpace opened this issue Mar 5, 2020 · 14 comments
Labels
feature New functionality/enhancement

Comments

@YesYouKenSpace
Copy link
Contributor

Wondering if a command atlantis destroy -d <dir> will be useful.
It will:

  1. User creates empty MR
  2. User comments atlantis destroy -d <dir>
  3. Atlantis generate destroy plan for <dir> and show it on the MR
  4. User commentsatlantis apply
  5. Atlantis destroys
  6. Atlantis makes a commit to the MR with <dir> deleted and merges the MR

Number 6, might be a little uncomfortable for some people.

@lkysow lkysow added the feature New functionality/enhancement label Mar 5, 2020
@jseiser
Copy link

jseiser commented Mar 24, 2020

I will say, the removal part of atlantis, is the most cumbersome part of our workflow.

We have things, that can only run from atlantis, so we endup having to create a BS pull request, something like adding a comment to a .tf file, then doing the destroy, then deleting the folders, pushing again, and finally merging.

@YesYouKenSpace
Copy link
Contributor Author

@jseiser That has been what my team and I have been doing too.

@nwsparks
Copy link

Having this as an available option would be fairly concerning.

If this was to be implemented I think you would also surely need to implement the ability to blacklist commands on the server side for people who did not want to expose this. It should probably also be defaulted to the blacklist and only available if you explicitly allow it.

@Symbianx
Copy link

I think it would be more user friendly creating the PR with the deletion of the directory.
Atlantis could then detect it and destroy the project using the directory from the target branch?

@YesYouKenSpace
Copy link
Contributor Author

I like @Symbianx 's suggestion and it seems if implemented as per that suggestion would address the concern @nwsparks has?

@lkysow
Copy link
Member

lkysow commented Jul 17, 2020

That does seem like a good workflow since you're gonna want to delete the directory anyway. Might be a bit tricky to implement though.

@mwarkentin
Copy link
Contributor

That would be a lovely workflow. We currently plan destroy and apply outside of atlantis, then make the PR.

@Silthus
Copy link

Silthus commented Aug 26, 2022

I think it would be more user friendly creating the PR with the deletion of the directory. Atlantis could then detect it and destroy the project using the directory from the target branch?

We at our company are currently also struggling with this problem and came to the same conclusion that it would be best for Atlantis to detect deleted folders and run a ... plan -destroy per deleted folder. That would allow mixing changes, additions and deletions in the same pull request.

Would you be open for a contribution to implement the destroy workflow? If so we would draft a suggestion.

@nitrocode nitrocode changed the title Atlantis Destroy Support atlantis destroy subcommand Oct 20, 2022
@nitrocode
Copy link
Member

This is a related issue here #193

And this is the workaround is here #193 (comment)

tldr here are the options

  1. Use an enabled = true input var or local, set everything to use it, then set it to enabled = false in a PR to do a destroy, then delete the terraform.
  2. Put in a PR (such as a no-op RR), use atlantis plan -- -destroy, get approval, then atlantis apply in order to destroy

@nitrocode
Copy link
Member

I do not believe this will be supported via atlantis destroy. Please see the above workarounds to see if it works better for you. We should probably document this on the website.

Closing for now unless the workarounds do not work for people.

@SerhiiSokolov
Copy link

SerhiiSokolov commented Jun 2, 2023

I wonder if this issue can be reopened. Workaround does not work when terragrunt with custom workflows, multi-providers and required checks are in place (
Having workflow like below to destroy resources is too complicated
image

@jamengual jamengual reopened this Jun 2, 2023
@jamengual
Copy link
Contributor

Project is community driven at this point so some of you will have to create a PR to get this feature.

@ShankyJS
Copy link

ShankyJS commented Jun 27, 2024

Do we have some high-level design/acceptance criteria for this issue? I want to take a stab at implementing this.

@nitrocode
Copy link
Member

nitrocode commented Oct 11, 2024

One thing to note is if you plan to use -destroy as an arg and you customize the plan step, make sure the $COMMENT_ARGS is still present

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

No branches or pull requests