From 966b174a44374599971701441f556a68e186c0f0 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Wed, 22 Jan 2025 17:33:24 +0200
Subject: [PATCH] Support more commands with OpenTofu 1.8.

OpenTofu 1.8 allows using the `-var-file` switch in almost all of the
commands. Terraform does not. Add support if not using Terraform.
---
 tf.py | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/tf.py b/tf.py
index 19bceb9..bdf6e12 100644
--- a/tf.py
+++ b/tf.py
@@ -10,8 +10,31 @@ import sys
 
 __version__ = "0.2.0"
 
-TF_COMMANDS_TO_MODIFY = ["plan", "console", "import", "refresh"]
 TF_CLI = os.getenv("TF_CLI", "terraform")
+TF_COMMANDS_TO_MODIFY = (
+    [
+        "console",
+        "import",
+        "plan",
+        "refresh",
+    ]
+    if TF_CLI == "terraform"
+    else [
+        "apply",
+        "console",
+        "destroy",
+        "destroy",
+        "get",
+        "import",
+        "init",
+        "output",
+        "plan",
+        "refresh",
+        "taint",
+        "untaint",
+        "validate",
+    ]
+)
 
 
 def get_workspace():
-- 
GitLab