This repository was archived by the owner on Apr 6, 2026. It is now read-only.
Implement dev_center_project_environment_type using GitHub Coding Agent with a new GH Issue Template #35
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: "Terraform Tests" | |
| on: | |
| pull_request: | |
| paths: | |
| - "**.tf" | |
| - "**.tfvars" | |
| - "**.tftest.hcl" | |
| - "tests/run_test.sh" | |
| - "tests/run_tests.sh" | |
| - ".github/workflows/terraform-tests.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| pre-check: | |
| name: Format and Validate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.12.1 | |
| - name: Terraform Init | |
| run: terraform init -backend=false | |
| - name: Terraform Format | |
| run: terraform fmt -check -recursive | |
| - name: Terraform Validate | |
| run: terraform validate | |
| discover-tests: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| unit_tests: ${{ steps.find-unit-tests.outputs.tests }} | |
| integration_tests: ${{ steps.find-integration-tests.outputs.tests }} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Find unit tests | |
| id: find-unit-tests | |
| run: | | |
| TESTS=$(find tests/unit -name "*_test.tftest.hcl" -type f | jq -R -s -c 'split("\n")[:-1]') | |
| echo "tests=$TESTS" >> $GITHUB_OUTPUT | |
| - name: Find integration tests | |
| id: find-integration-tests | |
| run: | | |
| TESTS=$(find tests/integration -name "*_test.tftest.hcl" -type f | jq -R -s -c 'split("\n")[:-1]') | |
| echo "tests=$TESTS" >> $GITHUB_OUTPUT | |
| unit-tests: | |
| needs: [pre-check, discover-tests] | |
| if: needs.discover-tests.outputs.unit_tests != '[]' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| test: ${{fromJson(needs.discover-tests.outputs.unit_tests)}} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.12.1 | |
| - name: Terraform Init | |
| run: terraform init -backend=false | |
| - name: Run Unit Test | |
| run: | | |
| TEST_DIR=$(dirname "${{ matrix.test }}") | |
| cd $TEST_DIR | |
| terraform init -input=false | |
| terraform test -verbose $(basename "${{ matrix.test }}") | |
| integration-tests: | |
| needs: [pre-check, discover-tests] | |
| if: needs.discover-tests.outputs.integration_tests != '[]' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| test: ${{fromJson(needs.discover-tests.outputs.integration_tests)}} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.12.1 | |
| - name: Terraform Init | |
| run: terraform init -backend=false | |
| - name: Run Integration Test | |
| run: | | |
| TEST_DIR=$(dirname "${{ matrix.test }}") | |
| cd $TEST_DIR | |
| terraform init -input=false | |
| terraform test -verbose $(basename "${{ matrix.test }}") | |
| comprehensive-tests: | |
| needs: [unit-tests, integration-tests] | |
| runs-on: ubuntu-latest | |
| if: always() | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - uses: hashicorp/setup-terraform@v3 | |
| with: | |
| terraform_version: 1.12.1 | |
| - name: Make test scripts executable | |
| run: | | |
| chmod +x tests/run_test.sh | |
| chmod +x tests/run_tests.sh | |
| - name: Run All Tests | |
| run: ./tests/run_tests.sh |