-
Notifications
You must be signed in to change notification settings - Fork 311
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
Feature request: handling deleted stacks via launch #1193
Comments
This argument seems dangerous to me, and stretches beyond what sceptre should be responsible for.
It's possible (and common in many projects I have worked on) that different stack repos are responsible for deploying different sceptre projects to the same account. Said repos can be deployed via different pipelines/people. If folks need to clean up stacks not managed by sceptre, there are already other methods and tools that can help there, for example
https://github.com/jckuester/awsls Why re-invent the wheel? |
Hey, thanks for your input here! I'm not at all concerned with deleting stacks unassociated with Sceptre. I'm concerned with stacks that USED to be associated with Sceptre. I think about the context of a CI/CD pipeline. When I push changes to stack configs or add stack configs, it applies those changes and stands up new stacks. Launch handles both those scenarios just fine. But if I want to remove a stack from the project that is no longer needed... Launch doesn't know. Sceptre doesn't have a way to see stacks that are on CF that have been removed from Sceptre.
My suggestion would care most about the project code. If you're using the project code correctly, it would be unique by project. In fact, ideally, it would be unique by environment as well. Of course, many folks might not have designed their sceptre configs properly and have not really cared about implementing a proper strategy to the project_code field. That's why it would be opt-in with the flag. But if the project code has been used properly, my plan proposed should work without the dangers you've described. |
I would agree with the fist part however disagree with the 2nd part. I think it would be appropriate for sceptre to somehow remove a remote stack when a user deletes its local stack config. It would be nice but I would agree with @craighurley that it's a dangerous operation that could cause serious problems for users. I do like this idea though and I don't see it being too dangerous as long as we figure out a good system to identify sceptre managed stacks. here are some initial questions..
|
I believe
I'm proposing that we always add those two extra tags to all stacks for every update and create actions, no matter if the user has
Yeah, I wanted the tag keys to start with "sceptre_" to distinguish them from any other tags. It would be what Sceptre calles the "sceptre_name", like "dev/something/or/another.yaml". This is NOT the same as the
Yeah, that's exactly what I'm suggesting. Those two tags would always be added to every stack, in addition to any other tags that might have been set on them. |
@zaro0508 @craighurley With the responses I've provided above, what are your thoughts on this feature? Do you think my proposal is viable? If the "danger" factor is still too much for you, we could introduce a new command, something like |
IMO, always tagging stacks with identifiable Sceptre properties is a generally useful even without the ability to delete stacks. I also think that your proposal is viable and I don't see why it should not work as you described. I also prefer this feature as a launch |
So I did some experimental development on this approach over the weekend. Here's what I found:
In the end, I have some prototype code code that can locate orphaned stacks. However, I'm wondering if it might be much cleaner and much safer if (instead of my proposed route), there was a simple stack config value that basically meant "delete this stack on launch". You could pretty much remove everything else from the stack configuration except maybe the stack_name. This would make the process of cleaning up stacks via CI/CD look like this: step 1: Add a "delete_on_launch: True" config to the StackConfig or something like that This approach would remove the need to locate remote stacks not represented by Stack Configs. If we do this, there will need to be to be some logic in the deletion. Any stack that depends on a stack marked for deletion would also need to be marked for deletion, otherwise the whole process should fail unless "ignore-dependencies" has been set. @craighurley, @zaro0508 what would you think of this alternative approach? |
I'm closing this issue in favor of #1212 |
Right now,
sceptre launch
will create new stacks and update existing stacks automatically. However, Sceptre doesn't currently see stacks that exist remotely but do not currently have a config locally. The only way to delete a stack via Sceptre is to have its Stack Config locally and runsceptre delete
explicitly. But if the Stack Config doesn't exist, Sceptre can't even do that.Requested behavior
When you run
sceptre launch --allow-delete
it would locate existing stacks that are in CloudFormation but do not currently exist in the local project and then delete them. When prompting the user before launch begins (unless -y is passed), it should list the stacks to be deleted separately to make it clear what deletions will occur.Why the
--allow-delete
flag?There are many situations where a user might be on a different branch or otherwise not want to delete stacks that aren't fully represented locally. As a result, it should be opt-in behavior; Otherwise it could have disastrous consequences.
How would it find remote-only stacks without state management?
It's important that Sceptre continues to avoid using a state management DB or file, since that's one of the "selling points" of Sceptre.
Instead, I propose that Sceptre be able to find remote-only stacks by:
Doing this should provide a list of stack names that are remote but not locally represented in configs.
The text was updated successfully, but these errors were encountered: