fix: update Terraform workflow to download and upload state files
Some checks failed
Terraform CI/CD / terraform (push) Has been cancelled

This commit is contained in:
2025-12-23 20:09:06 +01:00
parent 3dce4c1c4f
commit b6513aa86e
3 changed files with 16 additions and 417 deletions

View File

@@ -6,7 +6,7 @@ on:
jobs:
terraform:
runs-on: ssot
runs-on: ubuntu-latest
container:
image: hashicorp/terraform:1.6.6
@@ -23,6 +23,14 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
# Download previous Terraform state if it exists
- name: Download previous Terraform state
uses: actions/download-artifact@v3
with:
name: terraform-state
path: terraform/
continue-on-error: true # skip if no previous state exists
- name: Terraform Init
run: terraform -chdir=terraform init -input=false
@@ -46,3 +54,10 @@ jobs:
- name: Terraform Apply
if: github.ref == 'refs/heads/main'
run: terraform -chdir=terraform apply -input=false -auto-approve tfplan
# Upload updated Terraform state
- name: Upload Terraform state
uses: actions/upload-artifact@v3
with:
name: terraform-state
path: terraform/terraform.tfstate