fix: store Terraform state on shared mount for CI persistence

Terraform state was stored in the container's working directory
(fresh checkout), so it was lost between CI jobs. The cleanup job
couldn't destroy resources because it had no state.

Now stores state at /opt/pve-integration/work/terraform.tfstate via
-state flag on all terraform commands. This persists across the
provision → test → cleanup job chain in GitHub Actions.

Also:
- Force cleanup now removes state from both local and shared paths
- Added -reconfigure to terraform init (avoids backend mismatch errors)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-25 17:04:38 -05:00
parent 94d5fe9944
commit 226f9d8a12
2 changed files with 12 additions and 7 deletions
+2
View File
@@ -209,6 +209,8 @@ jobs:
PVE_API_TOKEN: ${{ secrets.PVE_API_TOKEN }}
PVE_TARGET_NODE: ${{ vars.PVE_TARGET_NODE }}
PVE_PASSWORD: ${{ secrets.PVE_TEST_PASSWORD }}
# Terraform state is stored on the shared mount (/opt/pve-integration/work/)
# so it persists between CI jobs.
run: bash ${SCRIPTS_DIR}/run-integration.sh cleanup
# ── Clean up old container images from GHCR ──────────────────────────