Skip to content
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

merge stack_group_config to sceptre_user_data if sceptre_user_data told to #1058

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion sceptre/config/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def _construct_stack(self, rel_path, stack_group_config=None):
iam_role=config.get("iam_role"),
profile=config.get("profile"),
parameters=config.get("parameters", {}),
sceptre_user_data=config.get("sceptre_user_data", {}),
sceptre_user_data=self._parsed_sceptre_user_data(config, parsed_stack_group_config),
hooks=config.get("hooks", {}),
s3_details=s3_details,
dependencies=config.get("dependencies", []),
Expand All @@ -528,6 +528,22 @@ def _construct_stack(self, rel_path, stack_group_config=None):

del self.templating_vars["stack_group_config"]
return stack

def _parsed_sceptre_user_data(self, config, stack_group_config):
"""
merge `stack_group_config` if `sceptre_user_data` has `merge_config` set True
"""
sceptre_user_data = config.get("sceptre_user_data", {})

# ensure sceptre_user_data update the config
if sceptre_user_data.get("merge_config") is True:
tmp = copy.deepcopy(stack_group_config)
tmp.update({'region': config["region"]})
tmp.update({'profile': config.get("profile")})
tmp.update(sceptre_user_data)
sceptre_user_data = tmp

return sceptre_user_data

def _parsed_stack_group_config(self, stack_group_config):
"""
Expand Down