58 lines
1.5 KiB
YAML
58 lines
1.5 KiB
YAML
name: Terraform K8s Apps Validate on Pull Request
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "terraform/k8sapps/**"
|
|
types:
|
|
- opened
|
|
- synchronize
|
|
- reopened
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- .github/workflows/terraform-microk8s-validate.yml
|
|
|
|
jobs:
|
|
terraform-validate:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup environment
|
|
uses: ./.github/actions/setup-env
|
|
|
|
- name: Setup Ansible Environment
|
|
id: setup_ansible_env
|
|
uses: ./.github/actions/setup-ansible-env
|
|
with:
|
|
vault-master-password: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
ansible-user: ${{ secrets.ANSIBLE_USER }}
|
|
host-group: microk8s
|
|
|
|
- name: Setup Terraform Environment
|
|
uses: ./.github/actions/setup-terraform-env
|
|
|
|
- name: Setup Kubernetes Environment
|
|
uses: ./.github/actions/setup-k8s-env
|
|
with:
|
|
vault-master-password: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
ansible-user: ${{ secrets.ANSIBLE_USER }}
|
|
|
|
- name: Terraform Init and Validate
|
|
env:
|
|
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
run: |
|
|
cd terraform/k8sapps
|
|
sectool exec terraform init
|
|
sectool exec terraform validate
|
|
sectool exec terraform fmt -check
|
|
sectool exec terraform plan
|