aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.zshrc19
1 files changed, 19 insertions, 0 deletions
diff --git a/.zshrc b/.zshrc
index 74e8cf9..222ab79 100644
--- a/.zshrc
+++ b/.zshrc
@@ -466,3 +466,22 @@ export PATH="$HOME/go/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$HOME/.deno/bin:$PATH"
export PATH=/usr/local/go/bin:$PATH
+
+
+
+# Confirm before executing `terraform apply`.
+function terraform() {
+ local subcommand="$1"
+ if [[ $subcommand = "apply" ]]; then
+ echo "Are you sure to apply?"
+ echo -n "(y/n): "
+ read -r answer
+ if [[ $answer = "y" ]]; then
+ command terraform "$@"
+ else
+ echo "Cancelled."
+ fi
+ else
+ command terraform "$@"
+ fi
+}