diff --git a/.bashrc.d/terraform b/.bashrc.d/terraform index 7e70f5fe22e339c886d35bfdb934540f330d44a9..462ee86b1150ca4f25b9021361d0fe2a8aca31dd 100644 --- a/.bashrc.d/terraform +++ b/.bashrc.d/terraform @@ -13,5 +13,10 @@ alias tfvf='tf init -backend=false && tf validate && tf fmt -diff' tf-next () { current="$(tf workspace show)" next="$(tf workspace list | cut -c3- | grep --line-regexp --after-context=1 "$current" | tail +2)" + if [ -z "${next}" ] + then + red "Last workspace." + return + fi tf workspace select "$next" }