File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change 7171 exit 1
7272 fi
7373
74+ - name : Get outputs
75+ uses : ./terraform-output
76+ id : output
77+ with :
78+ path : tests/terraform-cloud
79+ workspace : ${{ github.head_ref }}-1
80+ backend_config : " token=${{ secrets.TF_API_TOKEN }}"
81+
82+ - name : Verify auto_apply terraform outputs with workspace prefix
83+ run : |
84+ if [[ "${{ steps.output.outputs.default }}" != "default" ]]; then
85+ echo "::error:: Variables not set correctly"
86+ exit 1
87+ fi
88+
89+ - name : Setup terraform with workspace name
90+ run : |
91+ mkdir fixed-workspace-name
92+ sed -e 's/prefix.*/name = "github-actions-${{ github.head_ref }}-1"/' tests/terraform-cloud/main.tf > fixed-workspace-name/main.tf
93+
94+ - name : Get outputs
95+ uses : ./terraform-output
96+ id : name-output
97+ with :
98+ path : fixed-workspace-name
99+ backend_config : " token=${{ secrets.TF_API_TOKEN }}"
100+
101+ - name : Verify auto_apply terraform outputs with workspace name
102+ run : |
103+ if [[ "${{ steps.name-output.outputs.default }}" != "default" ]]; then
104+ echo "::error:: Variables not set correctly"
105+ exit 1
106+ fi
107+
74108 - name : Check no changes
75109 uses : ./terraform-check
76110 with :
Original file line number Diff line number Diff line change @@ -198,7 +198,14 @@ function select-workspace() {
198198
199199 if [[ -s " $STEP_TMP_DIR /workspace_select" ]]; then
200200 start_group " Selecting workspace"
201- cat " $STEP_TMP_DIR /workspace_select"
201+
202+ if [[ $WORKSPACE_EXIT -ne 0 ]] && grep -q " workspaces not supported" " $STEP_TMP_DIR /workspace_select" && [[ $INPUT_WORKSPACE == " default" ]]; then
203+ echo " The full name of a remote workspace is set by the terraform configuration, selecting a different one is not supported"
204+ WORKSPACE_EXIT=0
205+ else
206+ cat " $STEP_TMP_DIR /workspace_select"
207+ fi
208+
202209 end_group
203210 fi
204211
You can’t perform that action at this time.
0 commit comments