mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
hack: add script to remove terraform providers
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
fffd2b79f2
commit
1663b3d795
36
hack/remove-tf-providers/remove.sh
Executable file
36
hack/remove-tf-providers/remove.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/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)"
|
Loading…
Reference in New Issue
Block a user