aboutsummaryrefslogtreecommitdiff
path: root/nix/tofu/backups.nix
blob: e76ed2e60bf0b81aa23ba050048ad4e34bbf8c8e (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{
  pkgs,
}:
pkgs.writeTextFile {
  name = "backups.tf.json";
  text = builtins.toJSON ([
    {
      terraform = {
        backend = {
          gcs = {
            bucket = "fcuny-infra-tofu-state";
            prefix = "backups";
          };
        };
      };
    }
    {
      provider = {
        google = [
          {
            project = "fcuny-infra";
            region = "us-west1";
          }
        ];
      };
    }
    {
      resource = {
        google_storage_bucket = {
          "backups" = {
            name = "fcuny-infra-backups";
            location = "us-west1";
            uniform_bucket_level_access = true;
            force_destroy = true;
            public_access_prevention = "enforced";
            storage_class = "NEARLINE";
          };
        };
      };
    }
  ]);
}