Skip to content

Commit eb230b2

Browse files
committed
Add shell action
1 parent c97d9a9 commit eb230b2

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.7.0 (29/10/2021)
2+
3+
* Added custom action `shell`: a bash login shell between component init and cleanup
4+
15
## 1.6.1 (24/05/2021)
26

37
FEATURES:

bin/terraform.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
##
99
# Set Script Version
1010
##
11-
readonly script_ver="1.6.1";
11+
readonly script_ver="1.7.0";
1212

1313
##
1414
# Standardised failure function
@@ -52,6 +52,7 @@ action:
5252
* apply / destroy
5353
* graph
5454
* taint / untaint
55+
* shell
5556
- Generic actions:
5657
* See https://www.terraform.io/docs/commands/
5758
@@ -679,7 +680,7 @@ case "${action}" in
679680
|| error_and_die "Terraform verbose graph generation failed";
680681
exit 0;
681682
;;
682-
'apply'|'destroy')
683+
'apply'|'destroy'|'refresh')
683684

684685
# Support for terraform <0.10 is now deprecated
685686
if [ "${action}" == "apply" ]; then
@@ -763,6 +764,10 @@ case "${action}" in
763764
'import')
764765
terraform "${action}" ${tf_var_params} ${extra_args} || error_and_die "Terraform ${action} failed.";
765766
;;
767+
'shell')
768+
echo -e "Here's a shell for the ${component} component.\nIf you want to run terraform actions specific to the ${environment} environment, pass the following options to your terraform commands:\n\n${tf_var_params} ${extra_args}\n\n'exit 0' / 'Ctrl-D' to continue, other exit codes will abort tfscaffold with the same code.";
769+
bash -l || exit "${?}";
770+
;;
766771
*)
767772
echo -e "Generic action case invoked. Only the additional arguments will be passed to terraform, you break it you fix it:";
768773
echo -e "\tterraform ${action} ${extra_args}";

0 commit comments

Comments
 (0)