cluster/nomad/regions/homelab-1/email.tf

76 lines
1.5 KiB
Terraform
Raw Normal View History

resource "vault_policy" "dovecot-policy" {
name = "dovecot-policy"
policy = <<EOF
path "kv/data/getmail" {
capabilities = ["read"]
}
EOF
}
resource "vault_policy" "getmail-policy" {
name = "getmail-policy"
policy = <<EOF
path "kv/data/dovecot" {
capabilities = ["read"]
}
EOF
}
resource "nomad_volume" "dovecot_maildir" {
type = "csi"
plugin_id = "nfs"
volume_id = "dovecot_maildir"
name = "dovecot_maildir"
external_id = "dovecot_maildir"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context = {
server = "blowhole.hosts.in.redalder.org"
share = "/var/nfs/dovecot/maildir"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nolock", "hard" ]
}
}
resource "nomad_volume" "getmail_getmail-d" {
type = "csi"
plugin_id = "nfs"
volume_id = "getmail_getmail-d"
name = "getmail_getmail-d"
external_id = "getmail_getmail-d"
capability {
access_mode = "single-node-writer"
attachment_mode = "file-system"
}
context = {
server = "blowhole.hosts.in.redalder.org"
share = "/var/nfs/getmail/getmail.d"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nolock", "hard" ]
}
}
resource "nomad_job" "email" {
jobspec = file("${path.module}/job/email.hcl")
hcl2 {
enabled = true
vars = {
flake_ref = "${var.flake_host}?rev=${var.flake_rev}&ref=${var.flake_ref}"
flake_sha = var.flake_sha
}
}
}