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