b7408fb4d8
- Created Gitea module with outputs, provider, and variables for deployment. - Implemented Mail module including configuration for Dovecot and Postfix, along with necessary resources such as secrets, config maps, and deployments. - Added Python script for bcrypt password hashing and integrated it into the Mail module. - Defined persistent volumes and claims for Seafile module, along with Nginx configuration for serving content. - Established necessary variables for all modules to ensure flexibility and configurability.
57 lines
1.9 KiB
Terraform
57 lines
1.9 KiB
Terraform
locals {
|
|
persistent_folder = var.persistent_folder
|
|
mail_path = "${local.persistent_folder}/mail"
|
|
mailboxes_path = "${local.mail_path}/mailboxes"
|
|
getmail_path = "${local.mail_path}/getmail"
|
|
postfix_path = "${local.mail_path}/postfix"
|
|
mail_backup_path = "${local.persistent_folder}/backup.mail"
|
|
|
|
getmail_jobs = flatten([
|
|
for account in var.email_accounts : [
|
|
for mailbox in account.mailboxes : {
|
|
name = "${account.recipient}-${mailbox}"
|
|
recipient = "${account.recipient}+${mailbox}"
|
|
domain = account.domain
|
|
server = account.receive.server
|
|
port = account.receive.port
|
|
username = account.username
|
|
password = account.password
|
|
mailbox = mailbox
|
|
delete_after = coalesce(account.delete_after, 30)
|
|
}
|
|
]
|
|
])
|
|
|
|
postfix_env_vars = {
|
|
# Email configuration
|
|
SMTP_HOST = var.relay_smtp_host
|
|
SMTP_PORT = var.relay_smtp_port
|
|
MY_PRIMARY_DOMAIN = var.primary_domain
|
|
MY_DESTINATION = join(",", [for account in var.email_accounts : account.domain])
|
|
MY_NETWORKS = "127.0.0.0/8"
|
|
MAILNAME = "smtp.${var.primary_domain}"
|
|
DOVECOT_AUTH_ADDRESS = "dovecot-auth.mail.svc.cluster.local"
|
|
DOVECOT_AUTH_PORT = 31000
|
|
DOVECOT_LMTP_ADDRESS = "dovecot-lmtp.mail.svc.cluster.local"
|
|
DOVECOT_LMTP_PORT = 31024
|
|
LOG_TO_STDOUT = 0
|
|
}
|
|
|
|
password_hashes = {
|
|
for account in var.email_accounts : account.username => data.external.password_hasher[account.username].result.hex_encoded_bcrypt_hash
|
|
}
|
|
|
|
postfix_secrets = {
|
|
SMTP_USER = {
|
|
key = "username"
|
|
name = kubernetes_secret.relay_mail_credentials.metadata[0].name
|
|
}
|
|
|
|
SMTP_PASSWORD = {
|
|
key = "password"
|
|
name = kubernetes_secret.relay_mail_credentials.metadata[0].name
|
|
}
|
|
}
|
|
}
|
|
|