mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-29 11:36:16 +01:00
102 lines
2 KiB
Terraform
102 lines
2 KiB
Terraform
|
variable "flake_ref" {
|
||
|
type = string
|
||
|
}
|
||
|
|
||
|
variable "flake_sha" {
|
||
|
type = string
|
||
|
}
|
||
|
|
||
|
# data "nomad_plugin" "nomad-driver-containerd" {
|
||
|
# plugin_id = "nomad-driver-containerd"
|
||
|
# wait_for_healthy = true
|
||
|
# }
|
||
|
|
||
|
resource "nomad_volume" "hydra-db" {
|
||
|
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
|
||
|
type = "csi"
|
||
|
plugin_id = "nfs"
|
||
|
volume_id = "hydra-db"
|
||
|
name = "hydra-db"
|
||
|
external_id = "hydra-db"
|
||
|
|
||
|
capability {
|
||
|
access_mode = "single-node-writer"
|
||
|
attachment_mode = "file-system"
|
||
|
}
|
||
|
|
||
|
context = {
|
||
|
server = "blowhole.in.redalder.org"
|
||
|
share = "/var/nfs/hydra-db"
|
||
|
}
|
||
|
|
||
|
mount_options {
|
||
|
fs_type = "nfs"
|
||
|
mount_flags = [ "nolock", "hard" ]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource "nomad_volume" "hydra-data" {
|
||
|
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
|
||
|
type = "csi"
|
||
|
plugin_id = "nfs"
|
||
|
volume_id = "hydra-data"
|
||
|
name = "hydra-data"
|
||
|
external_id = "hydra-data"
|
||
|
|
||
|
capability {
|
||
|
access_mode = "single-node-writer"
|
||
|
attachment_mode = "file-system"
|
||
|
}
|
||
|
|
||
|
context = {
|
||
|
server = "blowhole.in.redalder.org"
|
||
|
share = "/var/nfs/hydra-data"
|
||
|
}
|
||
|
|
||
|
mount_options {
|
||
|
fs_type = "nfs"
|
||
|
mount_flags = [ "nolock", "hard" ]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource "nomad_volume" "hydra-nix" {
|
||
|
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
|
||
|
type = "csi"
|
||
|
plugin_id = "nfs"
|
||
|
volume_id = "hydra-nix"
|
||
|
name = "hydra-nix"
|
||
|
external_id = "hydra-nix"
|
||
|
|
||
|
capability {
|
||
|
access_mode = "single-node-writer"
|
||
|
attachment_mode = "file-system"
|
||
|
}
|
||
|
|
||
|
context = {
|
||
|
server = "blowhole.in.redalder.org"
|
||
|
share = "/var/nfs/hydra-nix"
|
||
|
}
|
||
|
|
||
|
mount_options {
|
||
|
fs_type = "nfs"
|
||
|
mount_flags = [ "nolock", "hard" ]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
resource "vault_policy" "hydra-policy" {
|
||
|
name = "hydra-policy"
|
||
|
policy = file("${path.module}/hydra-policy.hcl")
|
||
|
}
|
||
|
|
||
|
resource "nomad_job" "hydra" {
|
||
|
jobspec = file("${path.module}/nomad.hcl")
|
||
|
|
||
|
hcl2 {
|
||
|
enabled = true
|
||
|
vars = {
|
||
|
flake_ref = var.flake_ref
|
||
|
flake_sha = var.flake_sha
|
||
|
}
|
||
|
}
|
||
|
}
|