Add altra terraform code

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-06-22 23:25:39 +02:00
parent 990b3ee8a2
commit 558f2b656c
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
4 changed files with 68 additions and 3 deletions

View file

@ -36,6 +36,13 @@ provider "registry.terraform.io/hashicorp/vault" {
]
}
provider "registry.terraform.io/hetznercloud/hcloud" {
version = "1.39.0"
hashes = [
"h1:0Zh37Dpokj8+S8BSdbj8N7/Z/Gamyy7iHMt83yDWcuc=",
]
}
provider "registry.terraform.io/magicrb/influxdb-v2" {
version = "0.4.6"
hashes = [

View file

@ -134,6 +134,7 @@
p.random
p.null
p.influxdb-v2
p.hcloud
] );
flake.nixosModules = {

53
terranix/altra.nix Normal file
View file

@ -0,0 +1,53 @@
{ tflib, lib, ... }:
let
inherit (lib)
singleton;
inherit (tflib)
tf;
in
{
terraform.required_providers = {
hcloud.source = "hetznercloud/hcloud";
};
resource."hcloud_primary_ip"."altra_ipv4" = {
name = "altra_ipv4";
datacenter = "fsn1-dc14";
type = "ipv4";
assignee_type = "server";
auto_delete = false;
delete_protection = true;
};
resource."hcloud_primary_ip"."altra_ipv6" = {
name = "altra_ipv6";
datacenter = "fsn1-dc14";
type = "ipv6";
assignee_type = "server";
auto_delete = false;
delete_protection = true;
};
resource."hcloud_ssh_key"."magic_rb" = {
name = "magic_rb";
public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFVkFvalffJ/SMjJGG3WPiqCqFygnWzhGUaeALBIoCsJ (none)";
};
resource."hcloud_server"."altra" = {
name = "altra";
image = "debian-12";
datacenter = "fsn1-dc14";
server_type = "cax11";
public_net = {
ipv4_enabled = true;
ipv4 = tf "hcloud_primary_ip.altra_ipv4.id";
ipv6_enabled = false;
ipv6 = tf "hcloud_primary_ip.altra_ipv6.id";
};
delete_protection = true;
rebuild_protection = true;
ssh_keys = singleton (tf "hcloud_ssh_key.magic_rb.id");
};
}

View file

@ -101,6 +101,11 @@ in
source = ./containers/nfs-csi;
};
module."altra" = elib.terraformModule {
name = "altra";
source = ./altra.nix;
};
imports = [
./lib
./modules/push_approles.nix
@ -118,9 +123,8 @@ in
};
terraform.required_providers = {
influxdb-v2 = {
source = "MagicRB/influxdb-v2";
};
hcloud.source = "hetznercloud/hcloud";
influxdb-v2.source = "MagicRB/influxdb-v2";
};
resource."vault_auth_backend"."approle" = {