Skip to content

Commit

Permalink
Set DEV_STACK variable if deploying to a dev stack
Browse files Browse the repository at this point in the history
This forces the autoscale lambda to use smaller tables for DynamoDB to
save money. The production min values are still way too high for use in
the dev stacks.
  • Loading branch information
movestill committed Jun 8, 2017
1 parent 2246305 commit bde4d35
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cloud_formation/configs/dynamolambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@
# written to SLACK_WEBHOOK_PATH.
VPC_DOMAIN = 'VPC_DOMAIN'

# Used to override normal autoscale rules when creating a developer's stack.
# All tables will use the autoscale rules defined by the "default" config to
# avoid spending too much. The production autoscale rules have minimums that
# are way too high for DynamoDB tables for developers.
DEV_STACK = 'DEV_STACK'

def create_config(session, domain):
"""
Create the CloudFormationConfiguration object.
Expand Down Expand Up @@ -166,6 +172,8 @@ def update_config_file(config_str, domain):
config_str (str): String representation of config file template.
"""
parser = configparser.ConfigParser()
# Disable default transform to lowercase of keys.
parser.optionxform = lambda option: option
parser.read_string(config_str)
parser.set('default', VPC_DOMAIN, domain)

Expand All @@ -176,6 +184,10 @@ def update_config_file(config_str, domain):
parser.set('default', SLACK_WEBHOOK_PATH, slack_path_prod)
else:
parser.set('default', SLACK_WEBHOOK_PATH, slack_path_dev)
if domain != 'integration.boss':
# Override normal autoscale parameters when deploying to a
# developer stack.
parser.set('default', DEV_STACK, '')
slack_path = parser.get('default', SLACK_WEBHOOK_PATH)

# Remove stack specific variables before outputting.
Expand Down

0 comments on commit bde4d35

Please sign in to comment.