made s3 buckets work

This commit is contained in:
Ingolf Wagner 2024-01-07 00:27:29 +01:00
parent de8a334588
commit cea37fb8ca
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
13 changed files with 76 additions and 103 deletions
terranix

View file

@ -1,48 +0,0 @@
{ pkgs, lib, ... }:
let
hcloud-modules = pkgs.fetchgit {
url = "https://github.com/mrVanDalo/terranix-hcloud.git";
rev = "5fa359a482892cd973dcc6ecfc607f4709f24495";
sha256 = "0smgmdiklj98y71fmcdjsqjq8l41i66hs8msc7k4m9dpkphqk86p";
};
#nixosInfect = pkgs.fetchgit {
# "url" = "https://github.com/elitak/nixos-infect.git";
# rev = "928f9e5e1d63e77a91f2ca57ffa2be1fef3078ec";
#sha256 = "0rs84c549l863vbnnqgnx7v6m2zlq0wz46jbhm4v1l1a25d966s1";
#};
in
{
imports = [ (toString hcloud-modules) ];
# configure admin ssh keys
users.admins.palo.publicKey =
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC6uza62+Go9sBFs3XZE2OkugBv9PJ7Yv8ebCskE5WYPcahMZIKkQw+zkGI8EGzOPJhQEv2xk+XBf2VOzj0Fto4nh8X5+Llb1nM+YxQPk1SVlwbNAlhh24L1w2vKtBtMy277MF4EP+caGceYP6gki5+DzlPUSdFSAEFFWgN1WPkiyUii15Xi3QuCMR8F18dbwVUYbT11vwNhdiAXWphrQG+yPguALBGR+21JM6fffOln3BhoDUp2poVc5Qe2EBuUbRUV3/fOU4HwWVKZ7KCFvLZBSVFutXCj5HuNWJ5T3RuuxJSmY5lYuFZx9gD+n+DAEJt30iXWcaJlmUqQB5awcB1S2d9pJ141V4vjiCMKUJHIdspFrI23rFNYD9k2ZXDA8VOnQE33BzmgF9xOVh6qr4G0oEpsNqJoKybVTUeSyl4+ifzdQANouvySgLJV/pcqaxX1srSDIUlcM2vDMWAs3ryCa0aAlmAVZIHgRhh6wa+IXW8gIYt+5biPWUuihJ4zGBEwkyVXXf2xsecMWCAGPWPDL0/fBfY9krNfC5M2sqxey2ShFIq+R/wMdaI7yVjUCF2QIUNiIdFbJL6bDrDyHnEXJJN+rAo23jUoTZZRv7Jq3DB/A5H7a73VCcblZyUmwMSlpg3wos7pdw5Ctta3zQPoxoAKGS1uZ+yTeZbPMmdbw== cardno:000611343142";
users.admins.terranix.publicKey = "${lib.fileContents ./sshkey.pub}";
# configure provisioning private Key to be used when running provisioning on the machines
provisioner.privateKeyFile = toString ./sshkey;
hcloud.nixserver = {
playground = {
enable = true;
channel = "nixos-20.09";
provisioners = [
#{
# file.source = "${nixosInfect}/nixos-infect";
# file.destination = "/root/nixos-infect";
#}
{
file.source = "${toString ./../../images/translate-setup}";
file.destination = "/root/translate-setup";
}
];
configurationFile = pkgs.writeText "configuration.nix" ''
{ pkgs, lib, config, ... }:
{ environment.systemPackages = [ pkgs.git ]; }
'';
};
};
}

View file

@ -1,48 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
let
terranix = pkgs.callPackage
(pkgs.fetchgit {
url = "https://github.com/mrVanDalo/terranix.git";
rev = "2.3.0";
sha256 = "030067h3gjc02llaa7rx5iml0ikvw6szadm0nrss2sqzshsfimm4";
})
{ };
terraform = pkgs.writers.writeBashBin "terraform" ''
export TF_VAR_hcloud_api_token=`${pkgs.pass}/bin/pass development/hetzner.com/api-token`
${pkgs.terraform_0_12}/bin/terraform "$@"
'';
in
pkgs.mkShell {
buildInputs = [
terranix
terraform
(pkgs.writers.writeBashBin "prepare" ''
set -e
set -o pipefail
${pkgs.openssh}/bin/ssh-keygen -P "" -f ${toString ./.}/sshkey
'')
(pkgs.writers.writeBashBin "build" ''
set -e
set -o pipefail
${terranix}/bin/terranix | ${pkgs.jq}/bin/jq '.' > config.tf.json
${terraform}/bin/terraform init
${terraform}/bin/terraform apply
'')
(pkgs.writers.writeBashBin "cleanup" ''
${terraform}/bin/terraform destroy
rm ${toString ./.}/config.tf.json
rm ${toString ./.}/sshkey
rm ${toString ./.}/sshkey.pub
rm ${toString ./.}/terraform.tfstate*
'')
];
}

View file

@ -1 +0,0 @@
terraform.tfstate*

View file

@ -1,19 +0,0 @@
# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
terraform {
required_providers {
namecheap = {
source = "namecheap/namecheap"
version = ">= 2.0.0"
}
}
}
# Namecheap API credentials
provider "namecheap" {
user_name = var.namecheap_user
api_user = var.namecheap_user
api_key = var.namecheap_api_key
}
variable "namecheap_user" {}
variable "namecheap_api_key" {}

View file

@ -1,73 +0,0 @@
locals {
minutes = 60
hours = 60 * local.minutes
days = 24 * local.hours
normal_ttl = 12 * local.hours
short_ttl = 30 * local.minutes
very_short_ttl = 2 * local.minutes
}
resource "namecheap_domain_records" "terranix" {
domain = "terranix.org"
mode = "OVERWRITE"
email_type = "OX"
# terranix.org
record {
address = "terranix.github.io"
hostname = "@"
mx_pref = 10
ttl = local.normal_ttl
type = "CNAME"
}
record {
address = "terranix.github.io"
hostname = "www"
mx_pref = 10
ttl = local.normal_ttl
type = "CNAME"
}
# matrix.terranix.org
record {
address = "144.76.13.147"
hostname = "matrix"
mx_pref = 10
ttl = local.normal_ttl
type = "A"
}
record {
address = "144.76.13.147"
hostname = "element"
mx_pref = 10
ttl = local.normal_ttl
type = "A"
}
# Github Challenges
record {
address = "c3fd9329fe"
hostname = "_github-challenge-terranix-org"
mx_pref = 10
ttl = local.normal_ttl
type = "TXT"
}
record {
address = "ece2e1608cde1d7785b1315d0b0019"
hostname = "_github-pages-challenge-terranix"
mx_pref = 10
ttl = local.normal_ttl
type = "TXT"
}
# Mail Challenges
record {
address = "v=DKIM1;k=rsa;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvlSGd9dcuYFJ8CNAIgF/IWzKD8MlW41V4QeMgWgAQvKCW4JU2pF9IlcQGN+7IQf4PtJlzr/ClUspex58q75IZUjcLCGU0QdaqWPveQuIlS4JwgQadfNc8JtOiDlUSxMWfpROyvNyLtXUQftUvmppJDml2evo2OA5CpN7cKPzR4KcVINHlaL23m7mw9rLWWIpoxaGgp/aTi/a9m3PovUQ/lfDPrgvnmEGIc9piVO3DVE64dB/7yAZe9Jd2Qka3nwq5x3so1YPIOKXVK8G40NlyBOfPdKOeKhERuFL5zMIsLlcJd0BeLiuVqobc6DWLQMjrKDUEVnBsx2dJmhosqeG2wIDAQAB"
hostname = "default._domainkey"
mx_pref = 10
ttl = local.normal_ttl
type = "TXT"
}
}

View file

@ -1,30 +0,0 @@
inputs = {
namecheap_user = run_cmd("--terragrunt-quiet", "pass", "show", "development/namecheap.com/username")
namecheap_api_key = run_cmd("--terragrunt-quiet", "pass", "show", "development/namecheap.com/api-key")
}
generate "provider" {
path = "__provider.tf"
if_exists = "overwrite_terragrunt"
contents = <<EOF
terraform {
required_providers {
namecheap = {
source = "namecheap/namecheap"
version = ">= 2.0.0"
}
}
}
# Namecheap API credentials
provider "namecheap" {
user_name = var.namecheap_user
api_user = var.namecheap_user
api_key = var.namecheap_api_key
}
variable "namecheap_user" { }
variable "namecheap_api_key" { }
EOF
}