about summary refs log tree commit diff
path: root/ops/gcp-backups/default.nix
blob: 0e9ed07c041a56bae4f4949f22ee2f4eb0034c39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{ pkgs }:
let
  terraform = pkgs.terraform.withPlugins (p: [
    p.google
  ]);
in
pkgs.stdenv.mkDerivation rec {
  name = "tf-gcp-backups";
  src = ./.;

  init = pkgs.writeShellScriptBin "tf-gcp-backups-init" ''
    set -ueo pipefail
    cd $(git rev-parse --show-toplevel)/ops/gcp-backups
    ${terraform}/bin/terraform init
  '';

  plan = pkgs.writeShellScriptBin "tf-gcp-backups-plan" ''
    set -ueo pipefail
    cd $(git rev-parse --show-toplevel)/ops/gcp-backups
    ${terraform}/bin/terraform plan
  '';

  apply = pkgs.writeShellScriptBin "tf-gcp-backups-apply" ''
    set -ueo pipefail
    cd $(git rev-parse --show-toplevel)/ops/gcp-backups
    ${terraform}/bin/terraform apply
  '';
}