inherit ssh keys from terraform

This commit is contained in:
Jörg Thalheim 2023-05-14 20:17:36 +02:00
parent 8ea980e9b3
commit 36e05c009a
3 changed files with 9 additions and 3 deletions

View File

@ -1,6 +1,9 @@
{ self, ... }: {
{ self, ... }: let
nixosVars = builtins.fromJSON (builtins.readFile ./nixos-vars.json);
in {
imports = [
self.nixosModules.nixos-wiki
self.nixosModules.hcloud
];
config.users.users.root.openssh.authorizedKeys.keys = nixosVars.ssh_keys;
}

View File

@ -1,6 +1,9 @@
{ self, ... }: {
{ self, ... }: let
nixosVars = builtins.fromJSON (builtins.readFile ./nixos-vars.json);
in {
imports = [
self.nixosModules.nixos-wiki
self.nixosModules.hcloud
];
config.users.users.root.openssh.authorizedKeys.keys = nixosVars.ssh_keys;
}

View File

@ -34,6 +34,6 @@ resource "hcloud_server" "nixos_wiki" {
locals {
nixos_vars = {
ipv6_address = hcloud_server.nixos_wiki.ipv6_address
ssh_keys = data.hcloud_ssh_keys.nixos_wiki.ssh_keys.*.public_key
ssh_keys = data.hcloud_ssh_keys.nixos_wiki.ssh_keys.*.public_key
}
}