From 55c9f4a8036b7eb4cc56b700d5d975f47029337a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 21 Apr 2023 17:18:33 +0300 Subject: [PATCH] feat(corp/ops): bootstrap separate corp terraform config 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 --- corp/ops/.envrc | 4 ++++ corp/ops/.gitignore | 2 ++ corp/ops/default.nix | 21 +++++++++++++++++++++ corp/ops/main.tf | 10 ++++++++++ 4 files changed, 37 insertions(+) create mode 100644 corp/ops/.envrc create mode 100644 corp/ops/.gitignore create mode 100644 corp/ops/default.nix create mode 100644 corp/ops/main.tf diff --git a/corp/ops/.envrc b/corp/ops/.envrc new file mode 100644 index 000000000..26049cf42 --- /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 000000000..c035e7291 --- /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 000000000..59a998cca --- /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 000000000..98cea4c63 --- /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" + } + } +}