Add Outputs to template documentation generator

This commit is contained in:
Stefan Reimer 2020-06-19 17:40:51 +01:00
parent 7093ce98dc
commit d4b6837260
3 changed files with 15 additions and 3 deletions

View File

@ -323,7 +323,7 @@ class Stack(object):
raise e
def create_docs(self, template=False):
""" Read template, parse documentation fragments, eg. parameter description
""" Read rendered template, parse documentation fragments, eg. parameter description
and create a mardown doc file for the stack
same idea as eg. helm-docs for values.yaml
"""
@ -345,6 +345,9 @@ class Stack(object):
if 'Parameters' in self.cfn_data:
data['parameters'] = self.cfn_data['Parameters']
if 'Outputs' in self.cfn_data:
data['outputs'] = self.cfn_data['Outputs']
doc_file = os.path.join(self.ctx['template_path'], self.rel_path, self.stackname.upper() + ".md")
with open(doc_file, 'w') as doc_contents:

View File

@ -25,3 +25,12 @@
| {{ p }} | {{ parameters[p]['Type'] | lower }} | {{ def }} | {{ format }} | {{ parameters[p]['Description'] }} |
{% endfor %}
{% endif %}
{% if outputs %}
## Outputs
| Output | Description |
|--------|-------------|
{% for p in outputs.keys() %}
| {{ p }} | {{ outputs[p]['Description'] }} |
{% endfor %}
{% endif %}

View File

@ -61,8 +61,8 @@ def setup_logging(debug):
def search_refs(template, attributes, mode):
""" Traverses a template and searches for all Fn::GetAtt calls to FortyTwo
adding them to the passed in attributes set
""" Traverses a template and searches for any remote references and
adds them to the attributes set
"""
if isinstance(template, dict):
for k, v in template.items():