infrastructure/justfile
Tine 1d4a6390b4
Some checks failed
/ lint (push) Failing after 39s
feat: encrypted states and env update
2025-01-02 17:19:03 +01:00

57 lines
No EOL
1.1 KiB
Makefile

# Always use devbox environment to run commands.
set shell := ["devbox", "run"]
# Load dotenv
set dotenv-load
mod k8s 'k8s.tjo.cloud'
mod network 'network.tjo.cloud'
mod ingress 'ingress.tjo.cloud'
default:
@just --list
dot-env-encrypt:
sops \
--encrypt \
--input-type=dotenv \
--output-type=dotenv \
.env > .env.encrypted
dot-env-decrypt:
sops \
--decrypt \
--input-type=dotenv \
--output-type=dotenv \
.env.encrypted > .env
tofu-state-encrypt:
#!/bin/bash
for file in $(find -name tofu.tfstate -o -name terraform.tfstate)
do
echo "Encrypting $file"
sops \
--encrypt \
--input-type=json \
--output-type=json \
$file > ${file}.encrypted
done
tofu-state-decrypt:
#!/bin/bash
for file in $(find -name tofu.tfstate.encrypted -o -name terraform.tfstate.encrypted)
do
echo "Decrypting $file"
sops \
--decrypt \
--input-type=json \
--output-type=json \
$file > ${file%.encrypted}
done
lint:
@tofu fmt -check -recursive .
@tflint --recursive
format:
@tofu fmt -recursive .
@tflint --recursive