mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-27 16:39:38 -05:00
1663b3d795
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
37 lines
810 B
Bash
Executable File
37 lines
810 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Script removes the .terraform directorys with the providers that were
|
|
# downloaded by terraform init.
|
|
|
|
set -euo pipefail
|
|
shopt -s inherit_errexit
|
|
|
|
dirs=$(find . -type d -name "*.terraform" | sort -ud)
|
|
|
|
if [[ -z ${dirs} ]]; then
|
|
echo "No .terraform directories found"
|
|
exit 0
|
|
fi
|
|
|
|
echo "Size of $(pwd): $(du -hs | cut -f1)"
|
|
echo
|
|
echo "Removing Terraform providers from the following directories:"
|
|
echo
|
|
echo "${dirs}"
|
|
echo
|
|
|
|
read -p "Should we delete them all? [y/n] " -n 1 -r
|
|
if [[ ! ${REPLY} =~ ^[Yy]$ ]]; then
|
|
echo "Aborting."
|
|
[[ $0 == "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
|
|
fi
|
|
echo
|
|
|
|
for dir in ${dirs}; do
|
|
echo "Removing ${dir}"
|
|
rm -rf "${dir}"
|
|
done
|
|
|
|
echo
|
|
echo "Size of $(pwd): $(du -hs | cut -f1)"
|