Skip to content

Hide outdated comments #664

Hide outdated comments

Hide outdated comments #664

Workflow file for this run

name: Test terraform-validate
on:
- pull_request
jobs:
valid:
runs-on: ubuntu-latest
name: valid
steps:
- name: Checkout
uses: actions/checkout@v4
- name: validate
uses: ./terraform-validate
id: validate
with:
path: tests/workflows/test-validate/valid
- name: Check valid
run: |
if [[ "${{ steps.validate.outputs.failure-reason }}" != "" ]]; then
echo "::error:: failure-reason not set correctly"
exit 1
fi
invalid:
runs-on: ubuntu-latest
name: Invalid terraform configuration
steps:
- name: Checkout
uses: actions/checkout@v4
- name: validate
uses: ./terraform-validate
id: validate
continue-on-error: true
with:
path: tests/workflows/test-validate/invalid
- name: Check invalid
run: |
if [[ "${{ steps.validate.outcome }}" != "failure" ]]; then
echo "Validate did not fail correctly"
exit 1
fi
if [[ "${{ steps.validate.outputs.failure-reason }}" != "validate-failed" ]]; then
echo "::error:: failure-reason not set correctly"
exit 1
fi
validate_workspace:
runs-on: ubuntu-latest
name: Use workspace name during validation
steps:
- name: Checkout
uses: actions/checkout@v4
- name: validate prod
uses: ./terraform-validate
with:
path: tests/workflows/test-validate/workspace_eval
workspace: prod
- name: validate dev
uses: ./terraform-validate
with:
path: tests/workflows/test-validate/workspace_eval
workspace: dev
- name: validate nonexistant workspace
uses: ./terraform-validate
id: validate
continue-on-error: true
with:
path: tests/workflows/test-validate/workspace_eval
- name: Check invalid
run: |
if [[ "${{ steps.validate.outcome }}" != "failure" ]]; then
echo "Validate did not fail correctly"
exit 1
fi
if [[ "${{ steps.validate.outputs.failure-reason }}" != "validate-failed" ]]; then
echo "::error:: failure-reason not set correctly"
exit 1
fi
validate_remote_workspace:
runs-on: ubuntu-latest
name: Use workspace name during validation
steps:
- name: Checkout
uses: actions/checkout@v4
- name: validate prod
uses: ./terraform-validate
with:
path: tests/workflows/test-validate/workspace_eval_remote
workspace: prod
validate_unterminated_string:
runs-on: ubuntu-latest
name: Validate with unterminated string
steps:
- name: Checkout
uses: actions/checkout@v4
- name: validate
uses: ./terraform-validate
with:
path: tests/workflows/test-validate/unterminated-string
id: validate
continue-on-error: true
- name: Check invalid
run: |
if [[ "${{ steps.validate.outcome }}" != "failure" ]]; then
echo "Validate did not fail correctly"
exit 1
fi
if [[ "${{ steps.validate.outputs.failure-reason }}" != "validate-failed" ]]; then
echo "::error:: failure-reason not set correctly"
exit 1
fi