Skip to content

Commit a1664ce

Browse files
Disable Terraform state locking in VMSS deploy workflow
Added the '-lock=false' flag to both 'terraform plan' and 'terraform apply' steps in the GitHub Actions workflow to prevent state locking during deployment. This can help avoid issues in environments where state locking is not supported or causes conflicts. Revert "Update vmss-deploy.yml" This reverts commit eb8840b.
1 parent eb8840b commit a1664ce

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

.github/workflows/vmss-deploy.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ jobs:
5555
with:
5656
terraform_version: "1.5.0"
5757

58-
- name: Unlock Terraform state if locked
59-
working-directory: ./gh-runners
60-
continue-on-error: true
61-
run: terraform force-unlock -force 92cd93af-50cd-cede-d0fb-1d4a5fce69b2
62-
6358
- name: Terraform Init
6459
working-directory: ./gh-runners
6560
run: terraform init
@@ -72,14 +67,15 @@ jobs:
7267
working-directory: ./gh-runners
7368
run: |
7469
terraform plan \
70+
-lock=false \
7571
-var-file="variables.tfvars" \
7672
-var="github_token=${{ secrets.VMSS_GH_PAT }}" \
7773
-out=tfplan
7874
7975
- name: Terraform Apply
8076
if: github.event_name == 'push'
8177
working-directory: ./gh-runners
82-
run: terraform apply -auto-approve tfplan
78+
run: terraform apply -lock=false -auto-approve tfplan
8379

8480
- name: Deployment Summary
8581
if: github.event_name == 'push'

0 commit comments

Comments
 (0)