From 36e05c009a307822d609c5f77047f6fe4ab6fb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sun, 14 May 2023 20:17:36 +0200 Subject: [PATCH] inherit ssh keys from terraform --- targets/nixos-wiki.thalheim.io/configuration.nix | 5 ++++- targets/staging.nixos-wiki.thalheim.io/configuration.nix | 5 ++++- terraform/nixos-wiki/main.tf | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/targets/nixos-wiki.thalheim.io/configuration.nix b/targets/nixos-wiki.thalheim.io/configuration.nix index 9d57beb..5657f2a 100644 --- a/targets/nixos-wiki.thalheim.io/configuration.nix +++ b/targets/nixos-wiki.thalheim.io/configuration.nix @@ -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; } diff --git a/targets/staging.nixos-wiki.thalheim.io/configuration.nix b/targets/staging.nixos-wiki.thalheim.io/configuration.nix index 9d57beb..5657f2a 100644 --- a/targets/staging.nixos-wiki.thalheim.io/configuration.nix +++ b/targets/staging.nixos-wiki.thalheim.io/configuration.nix @@ -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; } diff --git a/terraform/nixos-wiki/main.tf b/terraform/nixos-wiki/main.tf index a58daba..d0def33 100644 --- a/terraform/nixos-wiki/main.tf +++ b/terraform/nixos-wiki/main.tf @@ -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 } }