40 lines
1.0 KiB
YAML
40 lines
1.0 KiB
YAML
name: Terraform AWS IAC Validate on Pull Request
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "terraform/iac/aws/**"
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
jobs:
|
|
iac-validate:
|
|
runs-on: cicd-base
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup environment
|
|
uses: ./.gitea/actions/setup-env
|
|
|
|
- name: Setup OpenTofu environment
|
|
uses: ./.gitea/actions/setup-opentofu-env
|
|
|
|
- name: OpenTofu Init and Validate
|
|
env:
|
|
BW_PROJECT_ID: ${{ secrets.BW_PROJECT_ID }}
|
|
BW_ORGANIZATION_ID: ${{ secrets.BW_ORGANIZATION_ID }}
|
|
BW_ACCESS_TOKEN: ${{ secrets.BW_ACCESS_TOKEN }}
|
|
run: |
|
|
cd terraform/iac/aws
|
|
sectool -f ../../sectool.json exec tofu init
|
|
sectool -f ../../sectool.json exec tofu validate
|
|
sectool -f ../../sectool.json exec tofu fmt -check
|
|
sectool -f ../../sectool.json exec tofu plan
|