TEST_STAND/PG: add comments to resources.tf explaining each parameter
This commit is contained in:
+41
-25
@@ -1,31 +1,39 @@
|
|||||||
|
# =============================================================================
|
||||||
|
# PostgreSQL — основной ресурс
|
||||||
|
# =============================================================================
|
||||||
resource "nubes_postgres" "npg" {
|
resource "nubes_postgres" "npg" {
|
||||||
resource_name = "pg4tf033777"
|
resource_name = "pg4tf033777" # ← ЗАМЕНИ на своё имя
|
||||||
|
|
||||||
|
# ── Платформа развёртывания ──
|
||||||
startup_configuration = jsonencode({
|
startup_configuration = jsonencode({
|
||||||
resourceRealm = var.realm
|
resourceRealm = var.realm # ← задаётся в terraform.tfvars
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# ── Размер кластера ──
|
||||||
cluster_configuration = jsonencode({
|
cluster_configuration = jsonencode({
|
||||||
cpu = "500"
|
cpu = "500" # ← милликоры (1000 = 1 vCPU)
|
||||||
memory = "512"
|
memory = "512" # ← MB
|
||||||
replicas = "1"
|
replicas = "1" # ← количество нод (1 = без реплики)
|
||||||
disk = "10"
|
disk = "10" # ← GB
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# ── Сетевой доступ ──
|
||||||
access_configuration = jsonencode({
|
access_configuration = jsonencode({
|
||||||
masterIpSpace = "no-needed"
|
masterIpSpace = "no-needed" # ← ipSpace для внешнего IP master
|
||||||
masterAccessList = []
|
masterAccessList = [] # ← список IP/сетей для доступа к master
|
||||||
slaveIpSpace = "no-needed"
|
slaveIpSpace = "no-needed" # ← ipSpace для внешнего IP slave
|
||||||
slaveAccessList = []
|
slaveAccessList = [] # ← список IP/сетей для доступа к slave
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# ── Параметры PostgreSQL ──
|
||||||
postgres_configuration = jsonencode({
|
postgres_configuration = jsonencode({
|
||||||
version = "17"
|
version = "17" # ← версия PostgreSQL (16, 17, ...)
|
||||||
sslRequired = true
|
sslRequired = true # ← требовать SSL
|
||||||
poolerMaster = false
|
poolerMaster = false # ← PgBouncer для master
|
||||||
poolerSlave = false
|
poolerSlave = false # ← PgBouncer для slave
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# ── Доп. параметры postgresql.conf (опционально, можно удалить блок) ──
|
||||||
postgres_conf = jsonencode([
|
postgres_conf = jsonencode([
|
||||||
{
|
{
|
||||||
paramName = "log_connections"
|
paramName = "log_connections"
|
||||||
@@ -33,33 +41,41 @@ resource "nubes_postgres" "npg" {
|
|||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# ── Резервное копирование ──
|
||||||
backup_configuration = jsonencode({
|
backup_configuration = jsonencode({
|
||||||
s3Uid = var.s3_uid
|
s3Uid = var.s3_uid # ← UUID S3 (задаётся в terraform.tfvars)
|
||||||
retain = "7"
|
retain = "7" # ← сколько бэкапов хранить
|
||||||
schedule = "0 0 * * *"
|
schedule = "0 0 * * *" # ← cron-расписание
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# ── Автоскейлинг ──
|
||||||
autoscale_configuration = jsonencode({
|
autoscale_configuration = jsonencode({
|
||||||
enabled = false
|
enabled = false # ← включить автоскейлинг
|
||||||
schedule = "0"
|
schedule = "0" # ← tech window
|
||||||
percent = "10"
|
percent = "10" # ← процент увеличения
|
||||||
quota = "100"
|
quota = "100" # ← максимальный размер диска (GB)
|
||||||
})
|
})
|
||||||
|
|
||||||
operation_timeout = "11m"
|
operation_timeout = "11m"
|
||||||
adopt_existing_on_create = true
|
adopt_existing_on_create = true # ← true = подхватить существующий инстанс
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# PostgreSQL — пользователь
|
||||||
|
# =============================================================================
|
||||||
resource "nubes_postgres_user" "pg_user" {
|
resource "nubes_postgres_user" "pg_user" {
|
||||||
postgres_id = nubes_postgres.npg.id
|
postgres_id = nubes_postgres.npg.id
|
||||||
username = "user0"
|
username = "user0" # ← ЗАМЕНИ на своё имя пользователя
|
||||||
role = "ddl_user"
|
role = "ddl_user" # ← app_user (базовый) или ddl_user (расширенный)
|
||||||
adopt_existing_on_create = true
|
adopt_existing_on_create = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# =============================================================================
|
||||||
|
# PostgreSQL — база данных
|
||||||
|
# =============================================================================
|
||||||
resource "nubes_postgres_database" "db2_app" {
|
resource "nubes_postgres_database" "db2_app" {
|
||||||
postgres_id = nubes_postgres.npg.id
|
postgres_id = nubes_postgres.npg.id
|
||||||
db_name = "dbterra"
|
db_name = "dbterra" # ← ЗАМЕНИ на своё имя БД (без подчёркиваний!)
|
||||||
db_owner = nubes_postgres_user.pg_user.username
|
db_owner = nubes_postgres_user.pg_user.username
|
||||||
adopt_existing_on_create = true
|
adopt_existing_on_create = true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,26 +6,33 @@ resource "nubes_postgres" "npg" {
|
|||||||
})
|
})
|
||||||
|
|
||||||
cluster_configuration = jsonencode({
|
cluster_configuration = jsonencode({
|
||||||
cpu = 500
|
cpu = "500"
|
||||||
memory = 512
|
memory = "512"
|
||||||
replicas = 1
|
replicas = "1"
|
||||||
disk = "1"
|
disk = "10"
|
||||||
})
|
})
|
||||||
|
|
||||||
access_configuration = jsonencode({
|
access_configuration = jsonencode({
|
||||||
masterIpSpace = ""
|
masterIpSpace = "no-needed"
|
||||||
masterAccessList = ""
|
masterAccessList = []
|
||||||
slaveIpSpace = ""
|
slaveIpSpace = "no-needed"
|
||||||
slaveAccessList = ""
|
slaveAccessList = []
|
||||||
})
|
})
|
||||||
|
|
||||||
postgres_configuration = jsonencode({
|
postgres_configuration = jsonencode({
|
||||||
version = "17"
|
version = "17"
|
||||||
sslRequired = false
|
sslRequired = true
|
||||||
poolerMaster = false
|
poolerMaster = false
|
||||||
poolerSlave = false
|
poolerSlave = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
postgres_conf = jsonencode([
|
||||||
|
{
|
||||||
|
paramName = "log_connections"
|
||||||
|
paramValue = "''"
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
backup_configuration = jsonencode({
|
backup_configuration = jsonencode({
|
||||||
s3Uid = var.s3_uid
|
s3Uid = var.s3_uid
|
||||||
retain = "7"
|
retain = "7"
|
||||||
@@ -34,9 +41,9 @@ resource "nubes_postgres" "npg" {
|
|||||||
|
|
||||||
autoscale_configuration = jsonencode({
|
autoscale_configuration = jsonencode({
|
||||||
enabled = false
|
enabled = false
|
||||||
schedule = ""
|
schedule = "0"
|
||||||
quota = "1"
|
percent = "10"
|
||||||
percent = 10
|
quota = "100"
|
||||||
})
|
})
|
||||||
|
|
||||||
operation_timeout = "11m"
|
operation_timeout = "11m"
|
||||||
@@ -52,7 +59,7 @@ resource "nubes_postgres_user" "pg_user" {
|
|||||||
|
|
||||||
resource "nubes_postgres_database" "db2_app" {
|
resource "nubes_postgres_database" "db2_app" {
|
||||||
postgres_id = nubes_postgres.npg.id
|
postgres_id = nubes_postgres.npg.id
|
||||||
db_name = "db_terra"
|
db_name = "dbterra"
|
||||||
db_owner = nubes_postgres_user.pg_user.username
|
db_owner = nubes_postgres_user.pg_user.username
|
||||||
adopt_existing_on_create = true
|
adopt_existing_on_create = true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user