Skip to content

Update Workflow for existing clusters #50

Update Workflow for existing clusters

Update Workflow for existing clusters #50

name: Terraform Validate
on:
pull_request:
workflow_dispatch:
jobs:
terraform-validate:
runs-on: "229685449397"
permissions:
contents: write
steps:
- name: Checkout code
uses: CSVD/gh-actions-checkout@v4
- name: Setup Terraform
uses: CSVD/gh-actions-setup-terraform@v2
with:
terraform_version: '1.7.3'
- name: Setup GITHUB Credentials
id: github_credentials
uses: CSVD/gh-auth@main
with:
github_app_pem_file: ${{ secrets.GH_APP_PEM_FILE }}
github_app_installation_id: ${{ vars.GH_APP_INSTALLATION_ID }}
github_app_id: ${{ vars.GH_APP_ID }}
- name: Validate Terraform Configuration
id: validate
uses: CSVD/terraform-validate@main
env:
GITHUB_TOKEN: ${{ steps.github_credentials.outputs.github_token }}
- name: Check Validation/Test Results
if: always()
run: |
# Set default values if outputs are empty
IS_VALID="${{ steps.validate.outputs.is_valid }}"
TESTS_PASSED="${{ steps.validate.outputs.tests_passed }}"
# If outputs are empty, set them to false
[ -z "$IS_VALID" ] && IS_VALID="false"
[ -z "$TESTS_PASSED" ] && TESTS_PASSED="false"
if [[ "$IS_VALID" != "true" || "$TESTS_PASSED" != "true" ]]; then
echo "Validation or test errors found:"
echo "${{ steps.validate.outputs.stderr }}"
exit 1
else
echo "All validations and tests passed successfully!"
fi