WIP: feat(infra): introduce Terranix #145

Draft
rlahfa wants to merge 3 commits from declarative-buckets into main
2 changed files with 33 additions and 0 deletions
Showing only changes of commit 33f7a082ce - Show all commits

View file

@ -2,5 +2,6 @@
imports = [
./common.nix
./state.nix
./s3.nix
];
}

32
terranix/s3.nix Normal file
View file

@ -0,0 +1,32 @@
{ lib, ... }:
let
inherit (lib) tf;
in
{
# FIXME: add a NixOS module to abstract bucket creation, etc.
config = {
terraform.required_providers.garage = {
version = "~> 1.0.3";
source = "registry.opentofu.org/RaitoBezarius/garage";
};
resource = {
secret_resource.admin-s3-token.lifecycle.prevent_destroy = true;
garage_bucket.monorepo-terraform-state = { };
garage_bucket_global_alias = {
monorepo-terraform-state = {
bucket_id = tf.ref "resource.garage_bucket.monorepo-terraform-state.id";
alias = "monorepo-terraform-state";
};
};
garage_key = { };
garage_bucket_key = { };
thubrecht marked this conversation as resolved Outdated

??

??

it's just to showcase how to use it

it's just to showcase how to use it

terraform won't delete things it doesn't know about FYI

terraform won't delete things it doesn't know about FYI
};
provider.garage = {
host = "s3-admin.dgnum.eu";
scheme = "https";
token = tf.ref "resource.secret_resource.admin-s3-token.value";
};
};
}