Skip to content

Commit a932a02

Browse files
committed
chore(ci): auto-commit module terraform lockfile and remove live lockfile
- add CI step to automatically commit updated .terraform.lock.hcl in module - remove incorrect lockfile from terragrunt/live/website - ensure init --upgrade no longer produces drift in live folders - maintain deterministic deploys while allowing provider upgrades
1 parent f4488a6 commit a932a02

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,22 @@ jobs:
8989
- name: Invalidate Cloudfront
9090
run: aws cloudfront create-invalidation --distribution-id ${{ steps.terragrunt_output.outputs.distribution_id }} --paths "/*"
9191

92+
- name: Auto-commit updated Terraform lockfile
93+
run: |
94+
git config --global user.email "actions@github.com"
95+
git config --global user.name "GitHub Actions"
96+
97+
# Only commit the module lockfile — live lockfiles must never exist
98+
git add terragrunt/modules/website/.terraform.lock.hcl
99+
100+
if git diff --cached --quiet; then
101+
echo "No lockfile changes to commit."
102+
else
103+
echo "Committing updated lockfile..."
104+
git commit -m "chore(terraform): update provider lock file"
105+
git push
106+
fi
107+
92108
- name: Check for uncommitted changes
93109
run: |
94110
git config --global --add safe.directory "$GITHUB_WORKSPACE"
@@ -110,6 +126,8 @@ jobs:
110126
echo "✅ No uncommitted changes after deploy."
111127
fi
112128
129+
130+
113131
- name: Upload lock files on failure
114132
if: failure()
115133
uses: actions/upload-artifact@v7

terragrunt/live/website/.terraform.lock.hcl

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)