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

Cannot destroy individual stack with requires #384

Closed
sdechgan opened this issue May 12, 2017 · 6 comments
Closed

Cannot destroy individual stack with requires #384

sdechgan opened this issue May 12, 2017 · 6 comments

Comments

@sdechgan
Copy link

I cannot destroy an individual stack that is required by another stack

For example:

Here is my stacker.yml

stacks:
  - name: stack1
    class_path: blueprints.application.Application
    enabled: true
  - name: stack2
    class_path: blueprints.s3.Event
    enabled: true
    requires:
      - stack1
  - name: stack3
    class_path: blueprints.api.OpenApi
    enabled: true
    requires:
      - stack1
      - stack2

Here is my command

stacker destroy --stacks stack3  environments/dev.env stack.yml

I get the following error:

[2017-05-12T14:53:29] Using Default AWS Provider
Traceback (most recent call last):
  File "~/.pyenv/bin/stacker", line 9, in <module>
    args.run(args)
  File "~/.pyenv/lib/python2.7/site-packages/stacker/commands/stacker/destroy.py", line 35, in run
    action.execute(force=options.force, tail=options.tail)
  File "~/.pyenv/lib/python2.7/site-packages/stacker/actions/base.py", line 124, in execute
    self.run(*args, **kwargs)
  File "~/.pyenv/lib/python2.7/site-packages/stacker/actions/destroy.py", line 100, in run
    plan = self._generate_plan(tail=tail)
  File "~/.pyenv/lib/python2.7/site-packages/stacker/actions/destroy.py", line 56, in _generate_plan
    stacks_dict[stack_name],
KeyError: 'dev-stack2'

Isn't that the correct command to delete an individual stack?

@phobologic
Copy link
Member

I think we could definitely have a better error there, but I think the logic is pretty sound. If stack3 requires stack2, then you shouldn't be able to destroy stack2 without destroying stack3 as well.

@sdechgan
Copy link
Author

Shouldn't you be able to delete stack3 without deleting stack2? Logically, stack2 doesn't need stack3 to work properly because stack3 was the last stack created.

That or I don't understanding is usage of the --stacks parameter.

@ejholmes
Copy link
Contributor

This looks like a legit bug when specifying --stacks with destroy, no? It errors out here when trying to generate the plan.

stack3 should only depend on stack2 during a build. During a destroy the graph should be transposed, so that stack2 depends on stack3. It's likely that this is already fixed in the DAG branch.

@jamietsao
Copy link

+1

@ejholmes ejholmes mentioned this issue Jun 21, 2017
Closed
9 tasks
@aarcro
Copy link

aarcro commented Nov 22, 2017

Still busted in 1.1.2 I'd really like to be able to destroy a single stack. Just going to nuke it from CloudFormation directly I suppose.

@ejholmes ejholmes mentioned this issue Jan 27, 2018
Merged
4 tasks
@ejholmes
Copy link
Contributor

ejholmes commented Feb 6, 2018

This will be fixed inthe next release of stacker. Stacker now builds a graph internally, and then transposes it to perform destroys.

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 a pull request may close this issue.

5 participants