Skip to content

Commit

Permalink
Fix custom binary tfsum (remove bashrc function)
Browse files Browse the repository at this point in the history
  • Loading branch information
containerscrew committed Apr 2, 2024
1 parent b2aa3b3 commit 8201446
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
18 changes: 0 additions & 18 deletions .bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,5 @@ if ! shopt -oq posix; then
fi
fi

tfsum() {
if [ -z "$1" ]; then
echo "You should type 'tfsum terraform|terragrunt'"
exit 1
fi

echo -en "Starting tf summary... Please wait\n"

if [ -n "$2" ] && [ "$2" == "-v" ]; then
"$1" plan -out plan.tfplan
else
"$1" plan -out plan.tfplan 1> /dev/null
fi

"$1" show -json plan.tfplan | tftools summarize --show-tags
if [ -f "plan.tfplan" ]; then rm plan.tfplan; fi
}

# Custom prompt
PS1="\[\033[38;5;92m\]\u\[\033[0m\]@\[\033[38;5;27m\]container-tools \[\033[0m\]\w \[\033[38;5;40m\]>\[\033[0m\]"
1 change: 1 addition & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,5 @@ RUN curl --proto '=https' --tlsv1.2 -sSfL https://raw.githubusercontent.com/cont
USER $USERNAME
WORKDIR $USER_HOME
COPY .bashrc .bashrc
COPY bin/* /usr/local/bin
ENTRYPOINT ["/bin/bash"]
17 changes: 17 additions & 0 deletions bin/tfsum
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "You should type 'tfsum terraform|terragrunt'"
exit 1
fi

echo -en "Starting tf summary... Please wait"

if [ -n "$2" ] && [ "$2" == "-v" ]; then
"$1" plan -out plan.tfplan
else
"$1" plan -out plan.tfplan 1> /dev/null
fi

"$1" show -json plan.tfplan | tftools summarize --show-tags
if [ -f "plan.tfplan" ]; then rm plan.tfplan; fi

0 comments on commit 8201446

Please sign in to comment.