@@ -539,24 +539,26 @@ fi;
539539[ -f " ${dynamic_file_path} " ] && tf_var_file_paths+=(" ${dynamic_file_path} " );
540540
541541# Warn on duplication
542- duplicate_variables=" $( cat " ${tf_var_file_paths[@]} " | sed -n -e ' s/\(^[a-zA-Z0-9_\-]\+\)\s*=.*$/\1/p' | sort | uniq -d) " ;
543- [ -n " ${duplicate_variables} " ] \
544- && echo -e "
545- ###################################################################
546- # WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING #
547- ###################################################################
548- The following input variables appear to be duplicated:
549-
550- ${duplicate_variables}
551-
552- This could lead to unexpected behaviour. Overriding of variables
553- has previously been unpredictable and is not currently supported,
554- but it may work.
555-
556- Recent changes to terraform might give you useful overriding and
557- map-merging functionality, please use with caution and report back
558- on your successes & failures.
559- ###################################################################" ;
542+ if [ ${# tf_var_file_paths[@]} -gt 0 ]; then
543+ duplicate_variables=" $( cat " ${tf_var_file_paths[@]} " | sed -n -e ' s/\(^[a-zA-Z0-9_\-]\+\)\s*=.*$/\1/p' | sort | uniq -d) " ;
544+ [ -n " ${duplicate_variables} " ] \
545+ && echo -e "
546+ ###################################################################
547+ # WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING #
548+ ###################################################################
549+ The following input variables appear to be duplicated:
550+
551+ ${duplicate_variables}
552+
553+ This could lead to unexpected behaviour. Overriding of variables
554+ has previously been unpredictable and is not currently supported,
555+ but it may work.
556+
557+ Recent changes to terraform might give you useful overriding and
558+ map-merging functionality, please use with caution and report back
559+ on your successes & failures.
560+ ###################################################################" ;
561+ fi
560562
561563# Build up the tfvars arguments for terraform command line
562564for file_path in " ${tf_var_file_paths[@]} " ; do
@@ -791,8 +793,8 @@ case "${action}" in
791793 ;;
792794 * )
793795 echo -e " Generic action case invoked. Only the additional arguments will be passed to terraform, you break it you fix it:" ;
794- echo -e " \tterraform ${action} ${extra_args} " ;
795- terraform " ${action} " ${extra_args} \
796+ echo -e " \tterraform ${action} ${extra_args} | tee terraform_output " ;
797+ terraform " ${action} " ${extra_args} | tee terraform_output \
796798 || error_and_die " Terraform ${action} failed." ;
797799 ;;
798800esac ;
0 commit comments