From d788b2f349f52a15da78ba9164bede2435118be0 Mon Sep 17 00:00:00 2001
From: zimbatm <zimbatm@zimbatm.com>
Date: Mon, 23 Jan 2023 14:59:06 +0100
Subject: [PATCH] terraform/terraform wrapper

Renamed the wrapper because all the usages of ./terraform/deploy were
invoking terraform. I also fixed an escaping issue that I encountered
when running `./terraform import 'some.resource["xxx"]' ID`
---
 .github/workflows/terraform.yml | 10 +++++-----
 terraform/{deploy => terraform} |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
 rename terraform/{deploy => terraform} (66%)

diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml
index 690f0bc..1a185e3 100644
--- a/.github/workflows/terraform.yml
+++ b/.github/workflows/terraform.yml
@@ -31,16 +31,16 @@ jobs:
             accept-flake-config = true
       - name: init
         if: steps.changes.outputs.terraform == 'true'
-        run: nix develop -c ./terraform/deploy terraform init -input=false
+        run: nix develop -c ./terraform/terraform init -input=false
       - name: validate
         if: steps.changes.outputs.terraform == 'true'
-        run: nix develop -c ./terraform/deploy terraform validate
+        run: nix develop -c ./terraform/terraform validate
       - name: fmt
         if: steps.changes.outputs.terraform == 'true'
-        run: nix develop -c ./terraform/deploy terraform fmt -check
+        run: nix develop -c ./terraform/terraform fmt -check
       - name: plan
         if: steps.changes.outputs.terraform == 'true' && github.ref == 'refs/heads/trying'
-        run: nix develop -c ./terraform/deploy terraform plan -input=false
+        run: nix develop -c ./terraform/terraform plan -input=false
       - name: apply
         if: steps.changes.outputs.terraform == 'true' && github.ref == 'refs/heads/staging'
-        run: nix develop -c ./terraform/deploy terraform apply -auto-approve -input=false
+        run: nix develop -c ./terraform/terraform apply -auto-approve -input=false
diff --git a/terraform/deploy b/terraform/terraform
similarity index 66%
rename from terraform/deploy
rename to terraform/terraform
index 1a0f6e8..5b407c9 100755
--- a/terraform/deploy
+++ b/terraform/terraform
@@ -4,6 +4,6 @@ set -euo pipefail
 pushd "$(dirname "$0")" >/dev/null
 
 # terraform cloud without the remote execution part
-TF_FORCE_LOCAL_BACKEND="1" sops exec-env secrets.yaml "${*@Q}"
+TF_FORCE_LOCAL_BACKEND="1" sops exec-env secrets.yaml "terraform ${*@Q}"
 
 popd >/dev/null