Skip to content

Commit 9ba6529

Browse files
committed
Support ancient Bash in bin/terraform-* scripts
1 parent a6249f0 commit 9ba6529

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

bin/terraform-apply

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,6 @@ if [ -f "${tf_vars_file}" ]; then
4444
tf_apply_args+=("-var-file=${tf_vars_file}")
4545
fi
4646

47-
terraform apply "${tf_apply_args[@]}"
47+
# tf_apply_args oddness to support Bash < v4.4
48+
# https://stackoverflow.com/a/7577209
49+
terraform apply ${tf_apply_args[@]+"${tf_apply_args[@]}"}

bin/terraform-init-and-apply

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ rest_args=("${@:3}")
1717

1818
./bin/terraform-init "${module_dir}" "${config_name}"
1919

20-
./bin/terraform-apply "${module_dir}" "${config_name}" "${rest_args[@]}"
20+
# rest_args oddness to support Bash < v4.4
21+
# https://stackoverflow.com/a/7577209
22+
./bin/terraform-apply "${module_dir}" "${config_name}" ${rest_args[@]+"${rest_args[@]}"}

0 commit comments

Comments
 (0)