55 lines
1.5 KiB
YAML
55 lines
1.5 KiB
YAML
name: Terraform K8S Apps apply
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "terraform/k8sapps/**"
|
|
|
|
jobs:
|
|
terraform-apply:
|
|
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
|
|
uses: ./.github/actions/setup-ansible-env
|
|
with:
|
|
vault_master_password: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
ansible_user: ${{ secrets.ANSIBLE_USER }}
|
|
trusted_hosts: ${{ secrets.TRUSTED_HOSTS }}
|
|
|
|
- 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
|
|
env:
|
|
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
run: |
|
|
cd terraform/k8sapps
|
|
sectool exec terraform init
|
|
|
|
- name: Terraform Apply
|
|
env:
|
|
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
ANSIBLE_USER: ${{ secrets.ANSIBLE_USER }}
|
|
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
|
run: |
|
|
# Apply the Terraform configuration
|
|
cd terraform/k8sapps
|
|
sectool exec terraform apply --auto-approve
|