51 lines
1.3 KiB
YAML
51 lines
1.3 KiB
YAML
name: Terraform IAC Apply
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 1 * * 0"
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "terraform/iac/**"
|
|
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 }}
|
|
host-group: iac
|
|
|
|
- name: Get Host Info
|
|
uses: ./.github/actions/get-host-info
|
|
id: get-host-info
|
|
with:
|
|
vault-master-password: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
ansible-user: ${{ secrets.ANSIBLE_USER }}
|
|
target-host: iac
|
|
|
|
- name: Setup Terraform environment
|
|
uses: ./.github/actions/setup-terraform-env
|
|
|
|
- name: Terraform Init and Apply
|
|
env:
|
|
VAULT_MASTER_PASSWORD: ${{ secrets.VAULT_MASTER_PASSWORD }}
|
|
SYSTEM_ID: ${{ steps.get-host-info.outputs.system-id }}
|
|
run: |
|
|
cd terraform/iac
|
|
export TF_VAR_system_id=$SYSTEM_ID
|
|
sectool exec terraform init
|
|
sectool exec terraform apply --auto-approve
|