File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -156,11 +156,13 @@ jobs:
156
156
run : |
157
157
set -e
158
158
terraform init -backend-config="env/${{ inputs.environment }}-backend.hcl" -upgrade
159
- terraform plan -var="image_digest=$DIGEST" -var="app_version=$APP_VERSION" -var-file="env/${{ inputs.environment }}.tfvars" \
160
- -out ${{ runner.temp }}/tfplan | tee ${{ runner.temp }}/tf_stdout
161
- - name : Validate the changes
162
- run : |
163
- set -e
159
+ terraform plan -var="image_digest=$DIGEST" -var-file="env/${{ inputs.environment }}.tfvars" \
160
+ -out ${{ runner.temp }}/tfplan &> ${{ runner.temp }}/tf_stdout
161
+ TF_EXIT_CODE=$?
162
+ cat ${{ runner.temp }}/tf_stdout
163
+ if [ $TF_EXIT_CODE -eq 1 ]; then
164
+ exit $TF_EXIT_CODE
165
+ fi
164
166
../scripts/validate_plan.sh ${{ runner.temp }}/tf_stdout
165
167
- name : Upload artifact
166
168
uses : actions/upload-artifact@v4
Original file line number Diff line number Diff line change @@ -38,11 +38,11 @@ tfstdout=$1
38
38
39
39
for resource in " ${down_time_if_destroyed[@]} " ; do
40
40
if [[ $( grep -cE " $resource .*(replaced|destroyed)" " $tfstdout " ) -ne 0 ]]; then
41
- echo " A resource is being destroyed: "
41
+ echo -e " \e[41mPOTENTIALLY CRITICAL RESOURCES ARE BEING DESTROYED:\e[0m "
42
42
grep -E " $resource .*(replaced|destroyed)" " $tfstdout "
43
- echo " This would cause a downtime. Aborting "
44
- exit 1
43
+ echo " Check carefully if this would cause a downtime"
44
+ exit 0
45
45
fi
46
46
done
47
47
48
- echo " No obvious downtime-relevant changes detected. Proceeding with the plan. "
48
+ echo -e " \e[32mNo obvious downtime-relevant changes detected.\e[0m "
You can’t perform that action at this time.
0 commit comments