cluster/infrastructure/email/main.tf

78 lines
1.6 KiB
Terraform
Raw Normal View History

variable "flake_ref" {
type = string
}
variable "flake_sha" {
type = string
}
resource "vault_policy" "dovecot-policy" {
name = "dovecot-policy"
policy = file("${path.module}/dovecot-policy.hcl")
}
resource "vault_policy" "getmail-policy" {
name = "getmail-policy"
policy = file("${path.module}/getmail-policy.hcl")
}
resource "nomad_volume" "dovecot_maildir" {
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
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.in.redalder.org"
share = "/var/nfs/dovecot/maildir"
}
mount_options {
fs_type = "nfs"
mount_flags = [ "nolock", "hard" ]
}
}
resource "nomad_volume" "getmail_getmail-d" {
# depends_on = [data.nomad_plugin.nomad-driver-containerd]
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.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}/nomad.hcl")
hcl2 {
enabled = true
vars = {
flake_ref = var.flake_ref
flake_sha = var.flake_sha
}
}
}