Skip to content

Commit 2188fbe

Browse files
committed
Output remote-run-id for remote runs
We must check the backend, the cloud backend can saved plan files now.
1 parent ee97dcc commit 2188fbe

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.github/workflows/test-version.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ jobs:
503503

504504
- name: Check the version
505505
run: |
506-
if [[ "${{ steps.terraform-version.outputs.terraform }}" != *"1.6"* ]]; then
506+
if [[ "${{ steps.terraform-version.outputs.terraform }}" != *"1.7"* ]]; then
507507
echo "::error:: Latest version was not used"
508508
exit 1
509509
fi

image/entrypoints/apply.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function apply() {
3232
if [[ -n "$PLAN_OUT" ]]; then
3333

3434
if [[ "$TERRAFORM_BACKEND_TYPE" == "cloud" ]]; then
35-
# Using the auto approve flag when applying a saved remote plan makes terraform hang
35+
# Using the auto approve flag when applying a saved cloud plan makes terraform hang
3636
# It does not prompt for approval anyway
3737
AUTO_APPROVE=""
3838
fi
@@ -59,6 +59,10 @@ function apply() {
5959
APPLY_EXIT=${PIPESTATUS[0]}
6060
>&2 cat "$STEP_TMP_DIR/terraform_apply.stderr"
6161

62+
fi
63+
set -e
64+
65+
if [[ "$TERRAFORM_BACKEND_TYPE" == "cloud" || "$TERRAFORM_BACKEND_TYPE" == "remote" ]]; then
6266
if remote-run-id "$STEP_TMP_DIR/terraform_apply.stdout" >"$STEP_TMP_DIR/remote-run-id.stdout" 2>"$STEP_TMP_DIR/remote-run-id.stderr"; then
6367
RUN_ID="$(<"$STEP_TMP_DIR/remote-run-id.stdout")"
6468
set_output run_id "$RUN_ID"
@@ -67,7 +71,6 @@ function apply() {
6771
debug_file "$STEP_TMP_DIR/remote-run-id.stderr"
6872
fi
6973
fi
70-
set -e
7174

7275
if [[ $APPLY_EXIT -eq 0 ]]; then
7376
output

tests/workflows/test-cloud/partial/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
terraform {
22
cloud {
3+
organization = "flooktech"
4+
5+
workspaces {
6+
name = "tf-cloud-1-6-cloud-1"
7+
}
38
}
49
required_version = "~> 1.6.0"
510
}

0 commit comments

Comments
 (0)