61 lines
1.5 KiB
Terraform
61 lines
1.5 KiB
Terraform
variable "infra" {
|
|
type = object({
|
|
postgres = object({
|
|
image = string
|
|
admin_user = string
|
|
host = string
|
|
port = number
|
|
internal_host = string
|
|
internal_port = number
|
|
})
|
|
pgadmin = object({
|
|
image = string
|
|
port = number
|
|
email = string
|
|
})
|
|
silo = object({
|
|
image = string
|
|
admin_user = string
|
|
host = string
|
|
port = number
|
|
console_port = number
|
|
internal_host = string
|
|
internal_port = number
|
|
state_bucket = string
|
|
backup_bucket = string
|
|
})
|
|
vault = object({
|
|
image = string
|
|
host = string
|
|
port = number
|
|
mount = string
|
|
database_mount = string
|
|
})
|
|
})
|
|
}
|
|
|
|
variable "services" {
|
|
type = map(object({
|
|
postgres = optional(object({
|
|
username = string
|
|
name = string
|
|
sslmode = optional(string, "disable")
|
|
pgvector = optional(bool, false)
|
|
}))
|
|
buckets = optional(map(object({
|
|
versioning = optional(bool, true)
|
|
noncurrent_days = optional(number, 30)
|
|
})), {})
|
|
}))
|
|
|
|
validation {
|
|
condition = alltrue(flatten([
|
|
for svc in values(var.services) : [
|
|
for name in keys(svc.buckets) :
|
|
can(regex("^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$", name))
|
|
]
|
|
]))
|
|
error_message = "Имя бакета: 3–63 символа, строчные латинские буквы, цифры, точки и дефисы."
|
|
}
|
|
}
|