From 114e2ef68e6ef139b4e769620c1904e4e08d5af7 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Thu, 22 Aug 2019 23:41:43 +0300
Subject: [PATCH] Terraform import wrapper.

---
 .bashrc | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/.bashrc b/.bashrc
index 1067cea..5e31e5e 100644
--- a/.bashrc
+++ b/.bashrc
@@ -161,6 +161,16 @@ tr () {
     fi
 }
 
+ti () {
+    workspace="$(terraform workspace show)"
+    if [ "$workspace" = "default" ]
+    then
+        terraform import "$@"
+    else
+        terraform import -var-file "$workspace.tfvars" "$@"
+    fi
+}
+
 genpass () {
     bytes="${1:-32}"
     head --bytes="$bytes" /dev/urandom | base64 --wrap=0
-- 
GitLab