Run Terraform Tests on CI #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run Terraform Tests on CI | |
| on: | |
| push: | |
| paths-ignore: | |
| - 'README.md' | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| schedule: | |
| # “At 00:00 on Sunday.” | |
| - cron: "0 0 * * 0" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| terraform: | |
| name: Deploy infrastructure using Terraform | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: "1.11.0" | |
| - name: Install Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Install tflocal | |
| run: | | |
| pip install terraform-local | |
| tflocal --version | |
| - name: Start LocalStack | |
| uses: LocalStack/setup-localstack@main | |
| with: | |
| image-tag: 'latest' | |
| install-awslocal: 'true' | |
| use-pro: 'true' | |
| configuration: LS_LOG=trace | |
| env: | |
| LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} | |
| - name: Run Terraform tests | |
| run: | | |
| tflocal init | |
| tflocal test | |
| - name: Check LocalStack logs | |
| run: | | |
| localstack logs |