@@ -40,13 +40,17 @@ jobs:
4040 aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
4141 aws-region : us-east-1
4242
43- - name : Update Terraform State and Providers
43+ - name : Initialize Terragrunt (backend + providers)
44+ # terragrunt init:
45+ # - Configures the remote backend (S3 + DynamoDB)
46+ # - Downloads provider versions pinned in the lockfile
47+ # - Prepares the working directory for plan/apply
4448 uses : gruntwork-io/terragrunt-action@v3
4549 env :
4650 TERRAGRUNT_DISABLE_COPY : true
4751 with :
4852 tg_dir : ${{ env.working_dir }}
49- tg_command : init --upgrade
53+ tg_command : init
5054
5155 - name : Terragrunt Plan
5256 uses : gruntwork-io/terragrunt-action@v3
8993 - name : Invalidate Cloudfront
9094 run : aws cloudfront create-invalidation --distribution-id ${{ steps.terragrunt_output.outputs.distribution_id }} --paths "/*"
9195
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-
10896 - name : Check for uncommitted changes
10997 run : |
11098 git config --global --add safe.directory "$GITHUB_WORKSPACE"
@@ -126,15 +114,3 @@ jobs:
126114 echo "✅ No uncommitted changes after deploy."
127115 fi
128116
129-
130-
131- - name : Upload lock files on failure
132- if : failure()
133- uses : actions/upload-artifact@v7
134- with :
135- name : terraform-lock-files
136- path : |
137- terraform/website/.terraform.lock.hcl
138- terragrunt/live/website/.terraform.lock.hcl
139- terragrunt/dev/website/.terraform.lock.hcl
140- if-no-files-found : ignore
0 commit comments