The security group and Network ACLs parts of CloudFormation templates can be difficult to read. This template containing Jinja macros converts easier-to-read YAML dictionaries of security group and NACL rules into JSON.
Here ais a generic macro template and some example files showing how to use it.
- cloudformation.macros.j2 - the macros
- cf_vars.yml - YAML dictionaly of security groups and NACLs, including some complex rules for both
- test.template.j2 - a simple CloudFormation template that uses the macro file
- cf_test.yml - a simple Ansible playbook that generates CloudFormation JSON from thr previous file.