machines/nix/modules/terranix/s3/default.nix

32 lines
775 B
Nix

{ lib, config, ... }:
let
cfg = config.khscodes.s3;
in
{
options.khscodes.s3 = {
enable = lib.mkEnableOption "Enables the s3 backend";
bucket = {
key = lib.mkOption {
type = lib.types.str;
description = "key for the bucket to use";
};
};
};
config = lib.mkIf cfg.enable {
terraform.backend.s3 = {
bucket = "bw-terraform";
key = cfg.bucket.key;
region = "auto";
endpoints = {
s3 = "https://477b394a6a545699445c40953e40f00b.r2.cloudflarestorage.com";
};
use_path_style = true;
skip_credentials_validation = true;
skip_region_validation = true;
skip_metadata_api_check = true;
skip_requesting_account_id = true;
skip_s3_checksum = true;
};
};
}