File tree Expand file tree Collapse file tree
actions/aws-terraform-runner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -214,21 +214,31 @@ runs:
214214 set -euo pipefail
215215 CMD="${{ inputs.tf_command }}"
216216
217- WS_IN="${{ inputs.tf_workspace }}"
218- if [[ -n "$WS_IN" ]]; then
219- WS="$WS_IN"
217+ if [[ -n "${{ inputs.tf_workspace }}" ]]; then
218+ WS="${{ inputs.tf_workspace }}"
220219 else
221- WS="$(terraform workspace show 2>/dev/null || echo default)"
220+ WS="$(terraform workspace show 2>/dev/null | tr -d '\r' | head -n1)"
221+ WS="${WS## }"; WS="${WS%% }"
222+ [[ -z "$WS" ]] && WS="default"
222223 fi
223224
224225 TFV="$(terraform version -json 2>/dev/null | sed -n 's/.*"terraform_version":"\([^"]*\)".*/\1/p')"
225226 [[ -z "$TFV" ]] && TFV="${{ inputs.tf_version }}"
226227
227- {
228- echo "terraform_command=$CMD"
229- echo "workspace=$WS"
230- echo "terraform_version=$TFV"
231- } >> "$GITHUB_OUTPUT"
228+ write_output () {
229+ local name="$1"; shift
230+ local val="$1"
231+ local delim="__${name}_$(date +%s%N)__"
232+ {
233+ echo "${name}<<${delim}"
234+ printf "%s\n" "$val"
235+ echo "${delim}"
236+ } >> "$GITHUB_OUTPUT"
237+ }
238+
239+ write_output terraform_command "$CMD"
240+ write_output terraform_version "$TFV"
241+ write_output workspace "$WS"
232242
233243 - name : Terraform Summary
234244 if : inputs.show_summary != 'false'
You can’t perform that action at this time.
0 commit comments