Application | IaaC | |
---|---|---|
Tool | Python | Terraform |
Version | 3.9 | 1.5.2 (AWS) |
The goal of this template is to provide:
- python linters setup (black, isort, flake8) using pre-commit
- python microservice structure using aws_lambda_powertools
- testing setup using pytest
- Cloud infrastructure (AWS) using IaaC (Terraform)
- Terraform linters
- Github Actions workflows to run tests, linters and execute Terraform
Clone the repository to your local machine.
Create a virtual environment
python -v venv .venv
source .venv/bin/active
Install dependencies:
python -m pip install -r requirements-dev.txt
pre-commit install
pre-commit run --all-files
This will run black, flake8, mypy, and Terraform linters on all files in the repository.
Navigate to the infra/terraform directory and run terraform init to initialize the Terraform configuration.
cd infra/terraform
terraform init
These commands will create the infrastructure specified in the Terraform configuration.
terraform plan
terraform apply
Run pre-commit for the Terraform configuration
Install tflint: https://github.com/terraform-linters/tflint
pre-commit run -a terraform
To run the tests, you can use the following command:
pytest
You can also use the -v option to get more detailed output:
pytest -v