Skip to content

Commit 44a1bb5

Browse files
committed
Remove the deprecated var input
1 parent 38926a9 commit 44a1bb5

File tree

5 files changed

+29
-62
lines changed

5 files changed

+29
-62
lines changed

.github/workflows/test-apply.yaml

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ jobs:
928928
929929
apply_vars:
930930
runs-on: ubuntu-24.04
931-
name: Apply approved changes with deprecated vars
931+
name: Apply changes with deprecated var
932932
permissions:
933933
contents: read
934934
pull-requests: write
@@ -940,45 +940,22 @@ jobs:
940940
with:
941941
persist-credentials: false
942942

943-
- name: Plan
944-
uses: ./terraform-plan
945-
with:
946-
path: tests/workflows/test-apply/deprecated_var
947-
var: my_var=hello
948-
var_file: tests/workflows/test-apply/test.tfvars
949-
950943
- name: Apply
951944
uses: ./terraform-apply
952-
id: output
945+
id: apply
953946
with:
954947
path: tests/workflows/test-apply/deprecated_var
955948
var: my_var=hello
956949
var_file: tests/workflows/test-apply/test.tfvars
950+
auto_approve: true
957951

958-
- name: Verify outputs
952+
- name: Check invalid
959953
env:
960-
OUTPUT_STRING: ${{ steps.output.outputs.output_string }}
961-
FROM_VAR: ${{ steps.output.outputs.from_var }}
962-
FROM_VARFILE: ${{ steps.output.outputs.from_varfile }}
963-
RUN_ID: ${{ steps.output.outputs.run_id }}
954+
APPLY_OUTCOME: ${{ steps.plan.outcome }}
964955
run: |
965-
if [[ "$OUTPUT_STRING" != "the_string" ]]; then
966-
echo "::error:: output s not set correctly"
967-
exit 1
968-
fi
969-
if [[ "$FROM_VAR" != "this should be overridden" ]]; then
970-
echo "::error:: output from_var not set correctly"
971-
exit 1
972-
fi
973-
if [[ "$FROM_VARFILE" != "monkey" ]]; then
974-
echo "::error:: output from_varfile not set correctly"
975-
exit 1
976-
fi
977-
978-
if [[ -n "$RUN_ID" ]]; then
979-
echo "::error:: run_id should not be set"
980-
exit 1
981-
fi
956+
if [[ "$APPLY_OUTCOME" != "failure" ]]; then
957+
echo "Using removed var input did not fail correctly."
958+
exit 1
982959
983960
apply_refresh:
984961
runs-on: ubuntu-24.04

.github/workflows/test-plan.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,20 @@ jobs:
922922

923923
- name: Plan
924924
uses: ./terraform-plan
925+
id: plan
926+
continue-on-error: true
925927
with:
926928
path: tests/workflows/test-plan/sensitive_var
927929
var: my_sensitive_var=hello
928930

931+
- name: Check invalid
932+
env:
933+
PLAN_OUTCOME: ${{ steps.plan.outcome }}
934+
run: |
935+
if [[ "$PLAN_OUTCOME" != "failure" ]]; then
936+
echo "Using removed var input did not fail correctly."
937+
exit 1
938+
929939
plan_change_run_commands:
930940
runs-on: ubuntu-24.04
931941
name: Change with shell init commands

docs-gen/inputs/var.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
type='string',
66
description='''
77
Comma separated list of $ProductName vars to set.
8-
This is deprecated due to the following limitations:
8+
This has been removed due to the following limitations:
99
- Only primitive types can be set with `var` - number, bool and string.
1010
- String values may not contain a comma.
1111
- Values set with `var` will be overridden by values contained in `var_file`s

image/actions.sh

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ function detect-tfmask() {
8181
if ! hash tfmask 2>/dev/null; then
8282
TFMASK="cat"
8383
fi
84-
85-
export TFMASK
8684
}
8785

8886
function execute_run_commands() {
@@ -185,8 +183,6 @@ function set-init-args() {
185183
fi
186184

187185
create-auto-tfvars
188-
189-
export INIT_ARGS
190186
}
191187

192188
##
@@ -383,29 +379,13 @@ function set-common-plan-args() {
383379
fi
384380
}
385381

386-
function set-deprecated-var-args() {
387-
DEPRECATED_VAR_ARGS=""
388-
389-
if [[ -n "$INPUT_VAR" ]]; then
390-
for var in $(echo "$INPUT_VAR" | tr ',' '\n'); do
391-
DEPRECATED_VAR_ARGS="$DEPRECATED_VAR_ARGS -var $var"
392-
done
393-
fi
394-
}
395-
396-
function masked-deprecated-vars() {
397-
if [[ -n "$DEPRECATED_VAR_ARGS" ]]; then
398-
echo "-var <masked>"
399-
else
400-
echo ""
401-
fi
402-
}
403-
404382
function set-plan-args() {
405383
set-common-plan-args
406-
set-deprecated-var-args
407384

408-
export PLAN_ARGS
385+
if [[ -n "${INPUT_VAR:-}" ]]; then
386+
error_log "The var input has been removed. Use the variables input instead."
387+
exit 1
388+
fi
409389
}
410390

411391
function create-auto-tfvars() {
@@ -490,11 +470,11 @@ function plan() {
490470
fi
491471

492472
# shellcheck disable=SC2086
493-
debug_log $TOOL_COMMAND_NAME plan -input=false -no-color -detailed-exitcode -lock-timeout=300s $PARALLEL_ARG $PLAN_OUT_ARG $PLAN_ARGS "$(masked-deprecated-vars)"
473+
debug_log $TOOL_COMMAND_NAME plan -input=false -no-color -detailed-exitcode -lock-timeout=300s $PARALLEL_ARG $PLAN_OUT_ARG $PLAN_ARGS
494474

495475
set +e
496476
# shellcheck disable=SC2086
497-
(cd "$INPUT_PATH" && $TOOL_COMMAND_NAME plan -input=false -no-color -detailed-exitcode -lock-timeout=300s $PARALLEL_ARG $PLAN_OUT_ARG $PLAN_ARGS $DEPRECATED_VAR_ARGS ) \
477+
(cd "$INPUT_PATH" && $TOOL_COMMAND_NAME plan -input=false -no-color -detailed-exitcode -lock-timeout=300s $PARALLEL_ARG $PLAN_OUT_ARG $PLAN_ARGS) \
498478
2>"$STEP_TMP_DIR/terraform_plan.stderr" \
499479
| $TFMASK \
500480
| tee /dev/fd/3 "$STEP_TMP_DIR/terraform_plan.stdout" \
@@ -518,11 +498,11 @@ function plan() {
518498

519499
function destroy() {
520500
# shellcheck disable=SC2086
521-
debug_log $TOOL_COMMAND_NAME destroy -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS "$(masked-deprecated-vars)"
501+
debug_log $TOOL_COMMAND_NAME destroy -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS
522502

523503
set +e
524504
# shellcheck disable=SC2086
525-
(cd "$INPUT_PATH" && $TOOL_COMMAND_NAME destroy -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS $DEPRECATED_VAR_ARGS) \
505+
(cd "$INPUT_PATH" && $TOOL_COMMAND_NAME destroy -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS) \
526506
2>"$STEP_TMP_DIR/terraform_destroy.stderr" \
527507
| tee /dev/fd/3 \
528508
>"$STEP_TMP_DIR/terraform_destroy.stdout"

image/entrypoints/apply.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ function apply() {
5050

5151
set +e
5252
# shellcheck disable=SC2086,SC2016
53-
debug_log $TOOL_COMMAND_NAME apply -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS "$(masked-deprecated-vars)"
53+
debug_log $TOOL_COMMAND_NAME apply -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS
5454
# shellcheck disable=SC2086
55-
(cd "$INPUT_PATH" && $TOOL_COMMAND_NAME apply -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS $DEPRECATED_VAR_ARGS) \
55+
(cd "$INPUT_PATH" && $TOOL_COMMAND_NAME apply -input=false -no-color -auto-approve -lock-timeout=300s $PARALLEL_ARG $PLAN_ARGS) \
5656
2>"$STEP_TMP_DIR/terraform_apply.stderr" \
5757
| $TFMASK \
5858
| tee "$STEP_TMP_DIR/terraform_apply.stdout"

0 commit comments

Comments
 (0)