Skip to content

Commit 05e863a

Browse files
committed
Refactor variables inputs
1 parent 0a6af80 commit 05e863a

File tree

26 files changed

+108
-320
lines changed

26 files changed

+108
-320
lines changed

.github/actionlint.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,9 @@ paths:
4141
ignore:
4242
- 'property "random" is not defined in object type'
4343
- 'property "acme" is not defined in object type'
44+
.github/workflows/test-apply.yaml:
45+
ignore:
46+
- 'input "var" is not defined in action "terraform-apply"'
47+
.github/workflows/test-plan.yaml:
48+
ignore:
49+
- 'input "var" is not defined in action "terraform-plan"'

.github/workflows/test-apply.yaml

Lines changed: 8 additions & 29 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,43 +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
946+
continue-on-error: true
953947
with:
954948
path: tests/workflows/test-apply/deprecated_var
955949
var: my_var=hello
956950
var_file: tests/workflows/test-apply/test.tfvars
951+
auto_approve: true
957952

958-
- name: Verify outputs
953+
- name: Check invalid
959954
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 }}
955+
APPLY_OUTCOME: ${{ steps.apply.outcome }}
964956
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"
957+
if [[ "$APPLY_OUTCOME" != "failure" ]]; then
958+
echo "Using removed var input did not fail correctly."
980959
exit 1
981960
fi
982961

.github/workflows/test-plan.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,10 +922,21 @@ 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+
fi
939+
929940
plan_change_run_commands:
930941
runs-on: ubuntu-24.04
931942
name: Change with shell init commands

docs-gen/inputs/var.py

Lines changed: 2 additions & 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
@@ -27,6 +27,7 @@
2727
''',
2828
required=False,
2929
deprecation_message='Use the variables input instead.',
30+
available_in=[],
3031
#default='',
3132
show_in_docs=False
3233
)

0 commit comments

Comments
 (0)