sceptre icon indicating copy to clipboard operation
sceptre copied to clipboard

Feature Request: Conditional stacks

Open jfalkenstein opened this issue 2 years ago • 4 comments

Frequently, lately, I've been working where I'd really like to specify a flag on a StackConfig that basically is like:

skip_stack: {{ var.environment == "prod" }}

In this scenario, if the environment is "prod", Sceptre would completely ignore the StackConfig. But if the environment was something else, it would build it as usual.

While avoiding building an individual stack is fairly easy if you're directly launching a single stack (e.g. sceptre launch my_group/stack-a.yaml), it's not possible when launching a StackGroup (e.g. sceptre launch my_group) and there's a stack in that group that you only want considered a part of the group sometimes.

The only way to simulate this behavior right now is by putting the stack outside the StackGroup and creating a conditional dependency on that stack. But that's not as clean.

This feature will ultimately fulfills the feature described in #1193

jfalkenstein avatar Mar 15 '22 21:03 jfalkenstein

@zaro0508 , @craighurley I'm wondering what your thoughts would be on this ^^

jfalkenstein avatar Mar 15 '22 21:03 jfalkenstein

this might be related to the greedy pattern matching, issue #941, feature that was removed in ver 2.4.0. It looks like people are generally in favor of using a flag to revive something similar to pattern matching files for deployment. How about we add --include/--exclude command line flags to match file patterns to include/exclude on a sceptre deploy? It can be a regex or glob matcher.

zaro0508 avatar Mar 15 '22 22:03 zaro0508

Well, I'm not opposed to pattern matching. But I to be able to use jinja logic to determine whether or not a stack is included; using a cli flag doesn't give me that capability.

jfalkenstein avatar Mar 15 '22 22:03 jfalkenstein

related to issue #750

zaro0508 avatar Mar 16 '22 00:03 zaro0508