Remove legacy FortyTwo

This commit is contained in:
Stefan Reimer 2021-02-12 11:06:43 +00:00
parent 540d4c2faa
commit 07f8186461
2 changed files with 8 additions and 18 deletions

View File

@ -33,6 +33,10 @@ Commands:
validate Validates already rendered templates using cfn-lint validate Validates already rendered templates using cfn-lint
``` ```
## Config management
- Within the config folder each directory represents either a stack group if it has sub-directories, or an actual Cloudformation stack in case it is a leaf folder.
- The actual configuration for each stack is hierachly merged. Lower level config files overwrite higher-level values. Complex data structures like dictionaries and arrays are deep merged.
# Secrets # Secrets
CloudBender supports Mozilla's [SOPS](https://github.com/mozilla/sops) to encrypt values in any config yaml file since version 0.8.1 CloudBender supports Mozilla's [SOPS](https://github.com/mozilla/sops) to encrypt values in any config yaml file since version 0.8.1

View File

@ -52,7 +52,7 @@ class Stack(object):
self.tags = {} self.tags = {}
self.parameters = {} self.parameters = {}
self.outputs = {} self.outputs = {}
self.options = {'Legacy': False} self.options = {}
self.region = 'global' self.region = 'global'
self.profile = '' self.profile = ''
self.onfailure = 'DELETE' self.onfailure = 'DELETE'
@ -165,23 +165,9 @@ class Stack(object):
""" """
self.cfn_template = re.sub(_res, '', self.cfn_template) self.cfn_template = re.sub(_res, '', self.cfn_template)
# Add Legacy FortyTwo resource to prevent AWS from replacing existing resources for NO reason ;-(
include = [] include = []
search_refs(self.cfn_data, include, self.mode) search_refs(self.cfn_data, include, self.mode)
if self.mode != "Piped" and len(include) and self.options['Legacy']: if self.mode == "Piped" and len(include):
_res = """
FortyTwo:
Type: Custom::FortyTwo
Properties:
ServiceToken:
Fn::Sub: "arn:aws:lambda:${{AWS::Region}}:${{AWS::AccountId}}:function:FortyTwo"
UpdateToken: __HASH__
Include: {}""".format(sorted(set(include)))
self.cfn_template = re.sub(r'Resources:', r'Resources:' + _res + '\n', self.cfn_template)
logger.info("Legacy Mode -> added Custom::FortyTwo")
elif self.mode == "Piped" and len(include):
_res = "" _res = ""
for attr in include: for attr in include:
_res = _res + """ _res = _res + """
@ -221,7 +207,7 @@ class Stack(object):
except KeyError: except KeyError:
pass pass
# Add CloudBender or FortyTwo dependencies # Add CloudBender dependencies
include = [] include = []
search_refs(self.cfn_data, include, self.mode) search_refs(self.cfn_data, include, self.mode)
for ref in include: for ref in include:
@ -745,7 +731,7 @@ class Stack(object):
stacks.append(stack) stacks.append(stack)
break break
# Gather stack outputs, use Tag['Artifact'] as name space: Artifact.OutputName, same as FortyTwo # Gather stack outputs, use Tag['Artifact'] as name space: Artifact.OutputName
stack_outputs = {} stack_outputs = {}
for stack in stacks: for stack in stacks:
# If stack has an Artifact Tag put resources into the namespace Artifact.Resource # If stack has an Artifact Tag put resources into the namespace Artifact.Resource