feat(ci): Implémentation workflow Terraform multi-modules

This commit is contained in:
Tellsanguis 2025-11-07 10:27:09 +01:00
parent 830b7229db
commit 44e45a0f3d

View file

@ -27,17 +27,27 @@ jobs:
- name: Terraform Validate
run: |
cd terraform
tofu init -backend=false
tofu validate
for dir in terraform/pve*; do
if [ -d "$dir" ]; then
echo "--- Validating $dir ---"
(cd "$dir" && tofu init -backend=false && tofu validate)
fi
done
- name: Terraform Plan
if: github.event_name == 'push'
run: |
cd terraform
cp terraform.tfvars.example terraform.tfvars
tofu init
tofu plan -out=tfplan
for dir in terraform/pve*; do
if [ -d "$dir" ]; then
echo "--- Planning $dir ---"
(
cd "$dir" && \
cp ../terraform.tfvars.example terraform.tfvars && \
tofu init && \
tofu plan -out="tfplan-$(basename $dir)"
)
fi
done
env:
TF_VAR_proxmox_token_id: ${{ secrets.PROXMOX_TOKEN_ID }}
TF_VAR_proxmox_token_secret: ${{ secrets.PROXMOX_TOKEN_SECRET }}
@ -48,8 +58,8 @@ jobs:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-artifact@v4
with:
name: tfplan
path: terraform/tfplan
name: tfplans
path: terraform/pve*/tfplan-*
retention-days: 1
ci-ansible: