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"
nixos_flake_attr = "nixos-wiki2-thalheim-io"
nixos_vars_file = "${path.module}/nixos-vars.json"
sops_file = abspath("${path.module}/secrets.yaml")
tags = {
Terraform = "true"
Target = "nixos-wiki2.thalheim.io"

View File

@ -1,8 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail -x
mkdir -p var/lib/secrets
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
umask 0022

View File

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

View File

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