diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-06-24 13:38:18 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-06-24 13:38:18 +0900 |
| commit | e64ccbf0ca52198f6c0fc222ccb0b026f09f0f18 (patch) | |
| tree | 183566558e51611f16c761c23e0103734c24bf39 | |
| parent | cbe0be92936f83f1e668384a491ab91d95fd6462 (diff) | |
| download | dotfiles-e64ccbf0ca52198f6c0fc222ccb0b026f09f0f18.tar.gz dotfiles-e64ccbf0ca52198f6c0fc222ccb0b026f09f0f18.tar.zst dotfiles-e64ccbf0ca52198f6c0fc222ccb0b026f09f0f18.zip | |
zsh: confirm before executing `terraform apply`
| -rw-r--r-- | .zshrc | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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 +} |
