Testing the NiceGUI for Python. Running on an Azure Web App deployed with GitHub Actions.
In order for Terraform to be able to connect to Azure you'll need to create a service principal along with a secret. Once you create the service principal add the following secrets to your Github Repo under Repo Settings > Secrets and variables > Actions:
- AZURE_CLIENT_ID
- AZURE_CLIENT_SECRET
- AZURE_SUBSCRIPTION_ID
- AZURE_TENANT_ID
There are several workflows in this template which can be found under ./.github/workflows. Keep in mind these are very simple examples meant for my lab, and would not be appropriate for most production deployments.
This workflow installs Terraform and then runs terraform destory
. This is helpful for cleaning up lab environemnts so you don't get billed for something you're not using.
This workflow uses a pre-built action to run Terraform Docs. There is a config file located in the ./terraform directory which allows for customization. This action also supports more advanced configurations such as nested modules and Atlantis files. This workflow runs on any pull request and ensures that documentation markdown is generated before merging the pull request.
This is the core worklfow which actually applies the IaC (Infrastructure as Code) using Terraform. This workflow performs a number of actions:
- TFLint - This step runs a pre-built github action that runs TFLint and leaves appropriate comments directly on the code in the pull-request. reviewdog/action-tflint@master
- Terraform Format
- Terraform Validate
- Terraform Init
- Terraform Plan
- PR Comment Script - This step runs a custom bash script based on a script provided by Hashicorp. The script takes the output from the previous steps including the full Terraform Plan output and submits them as a comment on the PR for easy review.
- Terraform Apply - Once the PR has been merged into the main branch (or upon any commit directly to the main branch) the final action is to run Terraform Apply. This step will only run if the Terraform Plan step was successful.
The output from Terrform Docs can be found: here