Skip to content

StackMaster 3.0 Proposal: Environments #238

@patrobinson

Description

@patrobinson

Hello one and all,

In October StackMaster will turn three and we've decided the next major goal should be a 2.0 release. This is an opportunity to put all options on the table, including those that break the API. This issue is a place to discuss the proposal to solve the hottest topic in StackMaster today, Environments and their current implementation, Region Aliases. Feel free to comment here on this proposal as well as potential alternatives.

Problem Statement

It’s common to have other environments in addition to Production, which replicate all or some of Production stacks. We can share Parameters between environments, but it may also be beneficial to share Parameters within an environment (i.e. log server address).

The current method of using region aliases is limited. Users cannot create multiple environments in the same region and conflating the concept of an environment and region can make it difficult for multi-region services.

For the past year or more I've encouraged we defer any decision on this problem until we understood it better. Having found this problem in many seperate implementations across the Envato business I feel we have enough experience with the problem to make a well informed decision, but I'd love to hear from others who have also felt this pain including @johnf @rbayerl @nitehawk @berniedurfee-ge @flyinbutrs .

Relevant Issues and PRs:
#109
#180
#221
#115

Current Solutions

As discussed we can use region-aliases to deploy environments to different regions.

Alternatively you can have a seperate StackMaster path, with a different stack_master.yml file and parameter files, while linking to a shared template path. This makes it possible to have a directory structure like so:

- production/
-- stack_master.yml
-- parameters/
- staging/
-- stack_master.yml
-- parameters/
- templates/

However it introduces duplication between the stack_master.yml files.

Proposed Solution

Instead of using a region to delineate an environment, I propose we use an AWS Account. While this is again prescriptive, it’s at least best practice as recommended by Amazon. We can either fetch the account number (list-account-aliases) or take an environment variable to tell us what account we are in. Each “environment” would have a directory (similar to that described above) and it’s own stack_master.yml file, which contained stack_defaults such as tags and stacks that are specific to that environment. There would also be a "master" stack_master.yml file defining stacks that are applicable to both environments, which would be merged with the environment configuration at run time.

- production/
-- stack_master.yml
-- parameters/
- stack_master.yml
- staging/
-- stack_master.yml
-- parameters/
- templates/

This would not break existing functionality, users could continue to use a single StackMaster config file for all environments or one for each environment. Only when the environments: key is encountered in the top level config file would this functionality take effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionAn issue raised to discuss potential future features in StackMaster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions