We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9147c98 commit 579faebCopy full SHA for 579faeb
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,12 @@ 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
89
+ working-directory: terraform
80
90
- name: Pull terraform state
91
run: |
92
terraform show -json > $TF_WORKSPACE.tfstate.json
0 commit comments