To create version controlled infrastructure architecture diagrams, and have proper audit trails, we make use of a new concept called Diagram as Code or DaC.
This is still a work in progress, for implementation details, visit Diagrams, which lets us create diagrams programmatically using Python.
The only pre-requisite is you need to have python installed on your workstation. To setup the python environment for development, we need to install a few tools. Let's set them up:
- 
Install Poetry: # This is only for MacOS users, for other distros, refer the documentation brew install poetry
- 
Run initto initialize the project, similar tonpm initas in the case ofnpm:# This command will guide you through creating your `pyproject.toml` config. poetry init
- 
Add the Diagrams library to the poetry pyproject.tomlfile:# This command will create a virtualenv at $HOME/Library/Caches/pypoetry/virtualenvs/ poetry add diagrams
- 
To view the python environment path and executable location for your python project's virtualenv, use the env infocommand:poetry env info 
- 
To run the python file with the DaC definition, we need to set the python interpreter path in VSCode. Usecmd+shift+pto open up the command palette, and then type:Python: Select Interpreter-> click onEnter interpreter path...and then copy and paste the virtualenv executable path here by running the command in the previous step, i.e,poetry env info. This will help setup the default interpreter to use the exact virtualenv for your specified project.
This project is open-sourced under the MIT License. Please read the LICENSE for further details.