sceptre icon indicating copy to clipboard operation
sceptre copied to clipboard

Add ability to create a new stack with change sets

Open kirkhansen opened this issue 5 years ago • 6 comments

I would like to be able to use change sets on new stacks as well as existing stacks.

AWS/boto supports creating a new stack with change sets using the ChangeSetType keyword see here for details. To the untrained eye, it appears that updating the cli create and update to pass an argument of change_set_type to the create_change_set function, and updating that function to accept the new argument may get me the functionality I'm after. I'm up for a PR if this makes sense to implement.

Outputs may be a bit tricky to deal with, but I haven't gotten that far down the path yet.

It looks like there was an attempt to address this with #198 , but that appears to have been closed, and inactive for awhile (thus the new issue).

kirkhansen avatar Mar 22 '19 18:03 kirkhansen

That's a good catch. I just started using change-sets myself and haven't realized that my workflow will break anytime I add a new environment to my configs in CI/CD.

Here's the error:

$ sceptre create -y dummy test
/Users/msverdlik/.virtualenvs/sceptre/lib/python3.7/site-packages/yaml/constructor.py:126: 
An error occurred (ValidationError) when calling the CreateChangeSet operation: Stack [test-dummy] does not exist

m1keil avatar Apr 22 '19 03:04 m1keil

Yep I think we should support this. Also partly related to #520

ngfgrant avatar Apr 30 '19 14:04 ngfgrant

I have implemented a change locally to get basic change sets working when creating a new stack. I would like to inquire if you would accept a limited scope pull request for this... if so I think it would be good to clarify the exact scope of the changes before submitting a pull request.

plan/actions.py(create_change_set)

  • Add 2nd argument change_set_type to def
  • Add parameter change_set_type to create_change_set_kwargs as ChangeSetName

cli/create.py(create_command)

  • Add argument change_set_type=CREATE to plan.create_change_set call

cli/update.py(update_command)

  • Add argument change_set_type=UPDATE to plan.create_change_set call

Corresponding Tests & Documentation to be added as appropriate

ryderjgillen avatar Aug 23 '19 16:08 ryderjgillen

@ngfgrant any thoughts on @sacvalleytech's comment?

kirkhansen avatar Nov 19 '19 20:11 kirkhansen

Is there any chance of moving this along? At the moment we can't create changesets for new stacks, which breaks any ability to use changesets for a group when new stacks are involved, which means we can't preview our changes, which is dangerous for production deploys.

hill-labs-developers avatar Dec 17 '20 01:12 hill-labs-developers

This could be added at least for treating cases were there are no dependent stacks. Would solve my use case at least as I don't use sceptre for beyond single stacks creation/updates. A CLI option could be used to alter the default behavior.

roneystein avatar Jul 21 '22 19:07 roneystein