about summary refs log tree commit diff
path: root/ops/buildkite/default.nix
blob: 8e7c05c858063f6ead47dc622c31d6b0cfa6cd78 (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
{ pkgs }:
let
  terraform = pkgs.terraform.withPlugins (p: [
    p.buildkite
    p.google
  ]);
in
pkgs.stdenv.mkDerivation rec {
  name = "tf-buildkite";
  src = ./.;

  upload = pkgs.writeShellScriptBin "tf-buildkite-upload" ''
    set -ueo pipefail

    cd $(git rev-parse --show-toplevel)/ops/buildkite

    export BUILDKITE_API_TOKEN=$(pass api/buildkite-terraform-token)

    ${terraform}/bin/terraform init
    ${terraform}/bin/terraform plan
    ${terraform}/bin/terraform apply
  '';
}