Move configuration of secret source outside of provisioning setup
Some checks failed
/ dev-shell (push) Successful in 46s
/ terraform-providers (push) Successful in 51s
/ check (push) Failing after 2m44s
/ systems (push) Successful in 4m8s
/ rust-packages (push) Successful in 52s

itself
This commit is contained in:
Kaare Hoff Skovgaard 2025-08-04 22:02:47 +02:00
parent f0725c503f
commit eec5e02770
Signed by: khs
GPG key ID: C7D890804F01E9F0
4 changed files with 11 additions and 12 deletions

View file

@ -13,14 +13,6 @@ let
description = "Modules used to bring up the needed resources";
default = [ ];
};
secretsSource = lib.mkOption {
type = lib.types.enum [
"vault"
"bitwarden"
];
description = "Where to get the secrets for the provisioning from";
default = "vault";
};
};
usesEndpoint =
search: endpoint: config:
@ -82,6 +74,14 @@ in
options.khscodes.infrastructure.provisioning = {
pre = provisioning;
post = provisioning;
secretsSource = lib.mkOption {
type = lib.types.enum [
"vault"
"bitwarden"
];
description = "Where to get the secrets for the provisioning from";
default = "vault";
};
instanceUserData = lib.mkOption {
type = (pkgs.formats.json { }).type;
description = "User data that should be added to the instance during provisioning";

View file

@ -16,7 +16,7 @@ pkgs.writeShellApplication {
cmd="''${2:-apply}"
baseAttr='${inputs.self}#nixosConfigurations."'"$hostname"'".config.khscodes.infrastructure.provisioning'
config="$(nix build --no-link --print-out-paths "''${baseAttr}.postConfig")"
secretsSource="$(nix eval --raw "''${baseAttr}.post.secretsSource")"
secretsSource="$(nix eval --raw "''${baseAttr}.secretsSource")"
endpoints="$(nix eval --show-trace --json "''${baseAttr}.postEndpoints")"
if [[ "$config" == "null" ]]; then
echo "No postprovisioning needed"

View file

@ -17,7 +17,7 @@ pkgs.writeShellApplication {
cmd="''${2:-apply}"
baseAttr='${inputs.self}#nixosConfigurations."'"$hostname"'".config.khscodes.infrastructure.provisioning'
config="$(nix build --no-link --print-out-paths "''${baseAttr}.preConfig")"
secretsSource="$(nix eval --raw "''${baseAttr}.pre.secretsSource")"
secretsSource="$(nix eval --raw "''${baseAttr}.secretsSource")"
endpoints="$(nix eval --show-trace --json "''${baseAttr}.preEndpoints")"
if [[ "$config" == "null" ]]; then
echo "No preprovisioning needed"

View file

@ -27,8 +27,7 @@ in
server_type = "cax11";
};
# Cannot use vault for secrets source, as this is the server containing vault.
khscodes.infrastructure.provisioning.pre.secretsSource = "bitwarden";
khscodes.infrastructure.provisioning.post.secretsSource = "bitwarden";
khscodes.infrastructure.provisioning.secretsSource = "bitwarden";
khscodes.infrastructure.vault-server-approle.stage = "post";
khscodes.networking.fqdn = "security.kaareskovgaard.net";
khscodes.infrastructure.openbao.domain = "secrets.kaareskovgaard.net";