about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2023-04-21T14·18+0300
committertazjin <tazjin@tvl.su>2023-04-24T10·56+0000
commit55c9f4a8036b7eb4cc56b700d5d975f47029337a (patch)
tree52e8c2d89e5986f0297fb2abbb8cf87b9c7bafbb
parent159646787a9696bbea4a1274c18b2b72ee501100 (diff)
feat(corp/ops): bootstrap separate corp terraform config r/6107
Doesn't actually contain any configuration yet, just setting up TF
with the right providers and so on.

Change-Id: Ia7128dd977b4ff69eebaa36c6cad6ac104cafcdb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8492
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
-rw-r--r--corp/ops/.envrc4
-rw-r--r--corp/ops/.gitignore2
-rw-r--r--corp/ops/default.nix21
-rw-r--r--corp/ops/main.tf10
4 files changed, 37 insertions, 0 deletions
diff --git a/corp/ops/.envrc b/corp/ops/.envrc
new file mode 100644
index 000000000000..26049cf426a4
--- /dev/null
+++ b/corp/ops/.envrc
@@ -0,0 +1,4 @@
+out=$(nix-build ../.. -A corp.ops.deps --out-link ../../.gcroots/corp-deps)
+PATH_add "$out/bin"
+
+watch_file default.nix
diff --git a/corp/ops/.gitignore b/corp/ops/.gitignore
new file mode 100644
index 000000000000..c035e729186f
--- /dev/null
+++ b/corp/ops/.gitignore
@@ -0,0 +1,2 @@
+.terraform
+.terraform.lock.hcl
diff --git a/corp/ops/default.nix b/corp/ops/default.nix
new file mode 100644
index 000000000000..59a998cca032
--- /dev/null
+++ b/corp/ops/default.nix
@@ -0,0 +1,21 @@
+{ depot, lib, pkgs, ... }:
+
+depot.nix.readTree.drvTargets rec {
+  # Provide a Terraform wrapper with Yandex Cloud support.
+  terraform = pkgs.terraform.withPlugins (p: [
+    p.yandex
+  ]);
+
+  validate = depot.tools.checks.validateTerraform {
+    inherit terraform;
+    name = "corp";
+    src = lib.cleanSource ./.;
+  };
+
+  deps = depot.tools.depot-deps.overrideDeps {
+    tf-yandex = {
+      attr = "corp.ops.terraform";
+      cmd = "terraform";
+    };
+  };
+}
diff --git a/corp/ops/main.tf b/corp/ops/main.tf
new file mode 100644
index 000000000000..98cea4c63175
--- /dev/null
+++ b/corp/ops/main.tf
@@ -0,0 +1,10 @@
+# Terraform configuration for TVL corp infrastructure (on Yandex
+# Cloud).
+
+terraform {
+  required_providers {
+    yandex = {
+      source = "yandex-cloud/yandex"
+    }
+  }
+}