remove terraform database

closes #50
This commit is contained in:
Pim Kunis 2024-02-08 23:59:12 +01:00
parent a3ace01a6d
commit d0e02adcec
6 changed files with 0 additions and 55 deletions

View file

@ -21,8 +21,6 @@
nixosModule = { nixosModule = {
lab = { lab = {
terraformDatabase.enable = true;
storage = { storage = {
osDisk = "/dev/sda"; osDisk = "/dev/sda";
dataPartition = "/dev/nvme0n1p1"; dataPartition = "/dev/nvme0n1p1";

View file

@ -1,7 +1,6 @@
{ {
imports = [ imports = [
./storage.nix ./storage.nix
./terraform-database
./ssh-certificates.nix ./ssh-certificates.nix
./k3s ./k3s
./backups.nix ./backups.nix

View file

@ -1,49 +0,0 @@
{ pkgs, lib, config, ... }:
let cfg = config.lab.terraformDatabase;
in {
options.lab.terraformDatabase.enable = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
Whether to start a postgreSQL database for Terraform states
'';
};
config = lib.mkIf cfg.enable {
networking.firewall.interfaces.${config.lab.networking.mainNicNamePattern}.allowedTCPPorts = [ 5432 ];
services.postgresql = {
enable = true;
ensureDatabases = [ "terraformstates" ];
package = pkgs.postgresql_15;
enableTCPIP = true;
dataDir = "${config.lab.storage.dataMountPoint}/postgresql/${config.services.postgresql.package.psqlSchema}";
authentication = ''
hostssl terraformstates terraform all cert
'';
settings =
let
serverCert = builtins.toFile "postgresql_server.crt"
(builtins.readFile ./postgresql_server.crt);
in
{
ssl = true;
ssl_cert_file = serverCert;
ssl_key_file = config.age.secrets."postgresql_server.key".path;
ssl_ca_file = serverCert;
};
ensureUsers = [{ name = "terraform"; }];
};
age.secrets."postgresql_server.key" = {
file = ../../secrets/postgresql_server.key.age;
mode = "400";
owner = builtins.toString config.ids.uids.postgres;
group = builtins.toString config.ids.gids.postgres;
};
};
}

View file

@ -37,8 +37,6 @@
age.identityPaths = [ "/etc/age_ed25519" ]; age.identityPaths = [ "/etc/age_ed25519" ];
virtualisation.libvirtd.enable = true;
nix = { nix = {
package = pkgs.nixFlakes; package = pkgs.nixFlakes;
extraOptions = '' extraOptions = ''

View file

@ -10,7 +10,6 @@ let
encryptedFileNames = [ encryptedFileNames = [
"jefke_host_ed25519.age" "jefke_host_ed25519.age"
"jefke_user_ed25519.age" "jefke_user_ed25519.age"
"postgresql_server.key.age"
"atlas_host_ed25519.age" "atlas_host_ed25519.age"
"atlas_user_ed25519.age" "atlas_user_ed25519.age"
"lewis_host_ed25519.age" "lewis_host_ed25519.age"