-
Notifications
You must be signed in to change notification settings - Fork 47
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
Spike/WIP: Stack definition yaml files. Explicit parameter_files & parameters in stack definitions. #330
Conversation
Interesting @stevehodgkiss .. so just clarifying some observations. In the example, the There are production params being inherited in the example (determined via If thats true then there would be something like |
Yep, they'd be merged from first to last.
Yep, that's the idea. You can structure the stack yaml files on the filesystem however you see fit - for example, separate directories for staging/production. And you can share parameter files in any way that makes sense. More flexibility, less magic.
Yep, in the same way that there'd be 2 definitions in a The PR atm supports the existing approach and this one. |
Yep great gotcha, thanks for clarifying. Seems like a good idea. |
this is going in the right direction I like the idea that environments/region_defaults can be implemented without a massive refactor like i was thinking. I agree that it's better to be explicit about which parameter files are loaded. However i dislike allowing both approaches and merging the results from the existing hierarchical lookup with explicit parameter files as well as parameters defined in a stack definiition file. This could be very confusing and difficult to maintain I also am not sure if adding another file, the stack definition file, to the mix helps, as now you can have 3 files define the behaviour of a stack instead of just 2. This implies some more magic, while removing some other. I'd really like to nail down a name for and scope for a concept like what @grassdog referred to in #256 . This could be defined in a single file, like you've implemented. Then some "targets" for that stack, with the stack name and region as well as override parameters. The more I think about it, the more getting rid of a single stack_master.yml file with a directory of parameter files makes more sense. Imagine your scenario: myapp-web.yml: template: myapp.rb
parameter_files:
- shared_parameters/myapp-web.yml
targets:
blue:
region: us-east-1
allowed_accounts: '987654321'
tags:
Name: myapp-blue
parameter_files:
- shared_parameters/myapp-web-production.yml
green:
region: us-east-1
allowed_accounts: '987654321'
tags:
Name: myapp-blue
parameter_files:
- shared_parameters/myapp-web-production.yml
staging:
region: us-east-1
allowed_accounts: '123456789'
tags:
Name: myapp-blue
parameters:
staging: 'true'
bucket_name:
stack_output: foo/bucket_name stack_master apply myapp-web blue But this still involves the giant refactor I've been procrastinating over for 18 months |
Yeah, I was thinking about removing support for defining stacks in Interesting idea (the target example), but I wonder if the added complexity is worth it. That could be expressed without StackMaster needing to have the concept of a target though:
What benefit would modelling targets inside StackMaster bring vs allowing the user to lay it out like that manually? |
Should we enable it behind a feature flag? Have the ability to turn on/off explicit parameters, defaulting to off. With "stack definition" files my loosely held opinion is I'd rather have them be standalone, i.e. if a stack definition file is specified the stack_master.yml file is not referred to at all. But then again I haven't thought about your use case deeply
Nothing tangible at present, but I believe in the future when we can define multiple stacks a "target" applies then it'll prove more useful. For the purposes of this discussion it's not particularly useful as you have more concrete problems you want to solve. |
Some experimental changes to simplify StackMaster usage.
Stack definitions move from stack_master.yml to their own stack-name.yml
Stacks can be defined in their own YAML file and applied with
stack_master apply stack-name.yml
.region
must be defined instack-name.yml
orstack_master.yml
'sstack_defaults
.This adds flexibility in terms of how stacks are organised on the filesystem, and prevents
stack_master.yml
bloat.Explicitly define parameter files locations with
parameter_files
Adds the ability to explicitly define parameter file locations in stack definitions
parameter_files: [my-parameters.yml]
. The benefit here is less magic about where they're sourced from, and the ability to share parameter files in any way you see fit. For example, if we havemyapp-blue
andmyapp-green
, they could share a parameter file, whereas currently that's not possible without duplicating the parameters.Add the ability to define parameters in stack definitions
Used with stacks in
stack_master.yml
, this would make the file extremely bloated. When stacks are in their own yaml file though, it makes them easier to read and understand in context rather than being split over multiple files.These changes may remove the need to have any concept of environment/region alias as discussed as part of StackMaster 2.0.
Example
Here's a made up example using all these features:
Thoughts?