Skip to content

Terraform with junit reporing #35

Terraform with junit reporing

Terraform with junit reporing #35

Workflow file for this run

name: 'Terraform Tests'
on:
pull_request:
permissions:
contents: read
env:
TF_VAR_parent_id: project-e00pjzzrtk1fs3yavy
jobs:
terraform:
name: 'Terraform ${{ matrix.solution.name }}'
environment:
name: project-e00pjzzrtk1fs3yavy
runs-on: ubuntu-latest
strategy:
matrix:
solution:
- name: compute-testing
defaults:
run:
shell: bash
working-directory: ${{ matrix.solution.name }}
env:
TF_VAR_subnet_id: vpcsubnet-e00dgdntmhgkeej1z3
TF_VAR_loki_access_key_id: ${{ secrets.TF_VAR_LOKI_ACCESS_KEY_ID }}
TF_VAR_loki_secret_key: ${{ secrets.TF_VAR_LOKI_SECRET_KEY }}
AWS_S3_ENDPOINT: https://storage.eu-north1.nebius.cloud:443
steps:
# Checkout the repository to the GitHub Actions runner
- name: Checkout
uses: actions/checkout@v4
- name: Setup SSH keys and agent
run: |
ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''
eval $(ssh-agent)
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
echo "SSH_AGENT_PID=$SSH_AGENT_PID" >> $GITHUB_ENV
ssh-add
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "v1.10.0-alpha20240911"
- name: Set up S3cmd cli tool
uses: s3-actions/[email protected]
with:
region: eu-north1
access_key: ${{ secrets.TF_VAR_LOKI_ACCESS_KEY_ID }}
secret_key: ${{ secrets.TF_VAR_LOKI_SECRET_KEY }}
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc.
- name: Terraform Init
run: terraform init
# Checks that all Terraform configuration files adhere to a canonical format
- name: Terraform Format
run: terraform fmt -check -recursive . ../modules
# Run Terraform Tests
- name: Terraform Test
run: terraform test -verbose -junit-xml=tests/TEST-result.xml
- name: Test Summary
uses: test-summary/action@v2
with:
paths: "${{ matrix.solution.name }}/tests/TEST-result.xml"
if: always()
- name: Upload test results
run: s3cmd sync --recursive ${{ matrix.solution.name }}/tests s3://terraform-test-reports/
if: always()