feat(ci): Implémentation workflow Terraform multi-modules
This commit is contained in:
parent
830b7229db
commit
44e45a0f3d
1 changed files with 19 additions and 9 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue