We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 91c0d55 commit f87ba0cCopy full SHA for f87ba0c
1 file changed
.github/workflows/sync.yml
@@ -12,6 +12,10 @@ on:
12
description: Whether to acquire terraform state lock during sync
13
required: false
14
default: "true"
15
+ refresh:
16
+ description: Refresh terraform state before sync
17
+ required: false
18
+ default: "false"
19
20
jobs:
21
prepare:
@@ -77,6 +81,11 @@ jobs:
77
81
terraform workspace select "${TF_WORKSPACE_OPT}" || terraform workspace new "${TF_WORKSPACE_OPT}"
78
82
echo "TF_WORKSPACE=${TF_WORKSPACE_OPT}" >> $GITHUB_ENV
79
83
working-directory: terraform
84
+ - name: Refresh terraform state
85
+ if: ${{ github.event.inputs.refresh == 'true' }}
86
+ run:
87
+ echo "{}" > $TF_WORKSPACE.tfstate.json
88
+ terraform apply -refresh-only -auto-approve -lock=$TF_LOCK
80
89
- name: Pull terraform state
90
run: |
91
terraform show -json > $TF_WORKSPACE.tfstate.json
0 commit comments