fix sops file

This commit is contained in:
Jörg Thalheim 2023-10-24 18:37:53 +02:00 committed by mergify[bot]
parent 62fc9f681a
commit 667dd1454b
4 changed files with 13 additions and 2 deletions

View File

@ -15,6 +15,7 @@ module "wiki" {
domain = "nixos-wiki2.thalheim.io" domain = "nixos-wiki2.thalheim.io"
nixos_flake_attr = "nixos-wiki2-thalheim-io" nixos_flake_attr = "nixos-wiki2-thalheim-io"
nixos_vars_file = "${path.module}/nixos-vars.json" nixos_vars_file = "${path.module}/nixos-vars.json"
sops_file = abspath("${path.module}/secrets.yaml")
tags = { tags = {
Terraform = "true" Terraform = "true"
Target = "nixos-wiki2.thalheim.io" Target = "nixos-wiki2.thalheim.io"

View File

@ -1,8 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail -x
mkdir -p var/lib/secrets mkdir -p var/lib/secrets
umask 0177 umask 0177
sops --extract '["age-key"]' -d "secrets.yaml" > ./var/lib/secrets/age sops --extract '["age-key"]' -d "$SOPS_FILE" > ./var/lib/secrets/age
# restore umask # restore umask
umask 0022 umask 0022

View File

@ -29,7 +29,10 @@ module "deploy" {
target_host = hcloud_server.nixos_wiki.ipv4_address target_host = hcloud_server.nixos_wiki.ipv4_address
instance_id = hcloud_server.nixos_wiki.id instance_id = hcloud_server.nixos_wiki.id
extra_files_script = "${path.module}/decrypt-age-keys.sh" extra_files_script = "${path.module}/decrypt-age-keys.sh"
debug_logging = true extra_environment = {
SOPS_FILE = var.sops_file
}
debug_logging = true
} }
locals { locals {

View File

@ -20,6 +20,11 @@ variable "nixos_vars_file" {
description = "File to write NixOS configuration variables to" description = "File to write NixOS configuration variables to"
} }
variable "sops_file" {
type = string
description = "File to SOPS secrets file"
}
variable "nixos_flake_attr" { variable "nixos_flake_attr" {
type = string type = string
description = "NixOS configuration flake attribute" description = "NixOS configuration flake attribute"