From c82f3decdf0b5f1bc7f0fd44b49bc89754dab72e Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sun, 24 Mar 2024 14:47:31 +0200
Subject: [PATCH] Small fix to tf-next.

---
 .bashrc.d/terraform | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.bashrc.d/terraform b/.bashrc.d/terraform
index 7e70f5f..462ee86 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"
 }
-- 
GitLab