cluster/nomad/regions/homelab-1/hydra.tf
Magic_RB 5ed9ee1903
Terraform: add flake_ref to allow for branches
Signed-off-by: Magic_RB <magic_rb@redalder.org>
2022-09-18 18:33:26 +02:00

93 lines
1.9 KiB
HCL

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.hosts.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.hosts.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.hosts.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 = <<EOF
path "kv/data/hydra" {
capabilities = ["read"]
}
EOF
}
resource "nomad_job" "hydra" {
jobspec = file("${path.module}/job/hydra.hcl")
hcl2 {
enabled = true
vars = {
flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}"
flake_sha = var.flake_sha
}
}
}