Files
a13labs.infra/terraform/k8sapps/buckets.tf
T
alexandre.pires e6e85b00f7 feat(mail): enhance mail configuration with getmail and dovecot settings
- Added getmail configuration generation using template files.
- Introduced postfix and dovecot configuration checksums for deployment.
- Created new dovecot configuration file and sieve script for email handling.
- Updated main.tf to utilize local variables for configuration management.
- Removed redundant external password hasher from main.tf.

feat(nginx): improve nginx configuration management

- Centralized nginx configuration into a local variable with checksum.
- Created separate config maps for default website configurations.
- Updated deployment to utilize new configuration structure.

feat(sftpgo): add SFTPGo application deployment

- Introduced SFTPGo with Kubernetes resources including namespace, config maps, and secrets.
- Configured SFTPGo with SMTP settings and AWS credentials.
- Implemented health checks and volume mounts for persistent storage.

refactor(seafile): remove Seafile module

- Deleted Seafile module and associated resources as part of cleanup.
2025-05-05 00:47:36 +02:00

215 lines
4.8 KiB
Terraform

resource "random_string" "bucket_suffix" {
length = 8
lower = true
upper = false
special = false
}
resource "scaleway_object_bucket" "backup" {
name = "a13labs-backup-${random_string.bucket_suffix.result}"
project_id = var.scaleway_project_id
region = "fr-par"
lifecycle_rule {
id = "gitea-clean"
prefix = "gitea-backup/"
enabled = true
expiration {
days = local.cloud_backup_retention_days
}
}
lifecycle_rule {
id = "wordpress-clean"
prefix = "wordpress-backup/"
enabled = true
expiration {
days = local.cloud_backup_retention_days
}
}
lifecycle_rule {
id = "nextcloud-clean"
prefix = "nextcloud-backup/"
enabled = true
expiration {
days = local.cloud_backup_retention_days
}
}
lifecycle_rule {
id = "mail-clean"
prefix = "mail-backup/"
enabled = true
expiration {
days = local.cloud_backup_retention_days
}
}
}
resource "scaleway_object_bucket_policy" "backup" {
bucket = scaleway_object_bucket.backup.name
policy = jsonencode({
Version = "2023-04-17",
Id = "AllowAccess",
Statement = [
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "user_id:${var.scaleway_user_id}"
}
Resource = [
scaleway_object_bucket.backup.name,
"${scaleway_object_bucket.backup.name}/*",
]
},
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "application_id:${scaleway_iam_application.backup_app.id}"
}
Resource = [
scaleway_object_bucket.backup.name,
"${scaleway_object_bucket.backup.name}/*",
]
},
]
})
}
resource "scaleway_object_bucket" "nextcloud" {
name = "a13labs-nextcloud-${random_string.bucket_suffix.result}"
project_id = var.scaleway_project_id
region = "fr-par"
}
resource "scaleway_object_bucket_policy" "nextcloud" {
bucket = scaleway_object_bucket.nextcloud.name
policy = jsonencode({
Version = "2023-04-17",
Id = "AllowAccess",
Statement = [
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "user_id:${var.scaleway_user_id}"
}
Resource = [
scaleway_object_bucket.nextcloud.name,
"${scaleway_object_bucket.nextcloud.name}/*",
]
},
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "application_id:${scaleway_iam_application.nextcloud_app.id}"
}
Resource = [
scaleway_object_bucket.nextcloud.name,
"${scaleway_object_bucket.nextcloud.name}/*",
]
},
]
})
}
resource "scaleway_object_bucket" "dovecot" {
name = "a13labs-dovecot-${random_string.bucket_suffix.result}"
project_id = var.scaleway_project_id
region = "fr-par"
}
resource "scaleway_object_bucket_policy" "dovecot" {
bucket = scaleway_object_bucket.dovecot.name
policy = jsonencode({
Version = "2023-04-17",
Id = "AllowAccess",
Statement = [
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "user_id:${var.scaleway_user_id}"
}
Resource = [
scaleway_object_bucket.dovecot.name,
"${scaleway_object_bucket.dovecot.name}/*",
]
},
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "application_id:${scaleway_iam_application.dovecot_app.id}"
}
Resource = [
scaleway_object_bucket.dovecot.name,
"${scaleway_object_bucket.dovecot.name}/*",
]
},
]
})
}
resource "scaleway_object_bucket" "sftpgo" {
name = "a13labs-sftpgo-${random_string.bucket_suffix.result}"
project_id = var.scaleway_project_id
region = "fr-par"
}
resource "scaleway_object_bucket_policy" "sftpgo" {
bucket = scaleway_object_bucket.sftpgo.name
policy = jsonencode({
Version = "2023-04-17",
Id = "AllowAccess",
Statement = [
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "user_id:${var.scaleway_user_id}"
}
Resource = [
scaleway_object_bucket.sftpgo.name,
"${scaleway_object_bucket.sftpgo.name}/*",
]
},
{
Effect = "Allow"
Action = [
"s3:*",
]
Principal = {
SCW = "application_id:${scaleway_iam_application.sftpgo_app.id}"
}
Resource = [
scaleway_object_bucket.sftpgo.name,
"${scaleway_object_bucket.sftpgo.name}/*",
]
},
]
})
}