Skip to content

Commit

Permalink
feat: add terraform show command to wrapper script (#267)
Browse files Browse the repository at this point in the history
  • Loading branch information
fparga authored Oct 21, 2020
1 parent 12f02ec commit 2a8e9f2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion build/tf-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ tf_plan_validate_all() {
done
}

## terraform show for single environment.
tf_show() {
local path=$1
local tf_env=$2
local tf_component=$3
echo "*************** TERRAFORM SHOW *******************"
echo " At environment: ${tf_component}/${tf_env} "
echo "**************************************************"
if [ -d "$path" ]; then
cd "$path" || exit
terraform show "${tmp_plan}/${tf_component}-${tf_env}.tfplan" || exit 41
cd "$base_dir" || exit
else
echo "ERROR: ${path} does not exist"
fi
}

## terraform validate for single environment.
tf_validate() {
local path=$1
Expand Down Expand Up @@ -152,6 +169,10 @@ single_action_runner() {
tf_plan "$env_path" "$env" "$component"
;;

show )
tf_show "$env_path" "$env" "$component"
;;

validate )
tf_validate "$env_path" "$env" "$policyrepo" "$component"
;;
Expand All @@ -167,7 +188,7 @@ single_action_runner() {
}

case "$action" in
init|plan|apply|validate )
init|plan|apply|show|validate )
single_action_runner
;;

Expand Down

0 comments on commit 2a8e9f2

Please sign in to comment.