LUCEE: updated lucee.tf with new git_path, TABLE_NAME, user/db subresources

This commit is contained in:
“Naeel”
2026-07-19 18:54:09 +04:00
parent 6660008af1
commit 196d55a945
5 changed files with 76 additions and 51 deletions
+57
View File
@@ -0,0 +1,57 @@
locals {
pg_host = nubes_postgres.npg_lucee.state_out_flat["internalMaster"]
pg_user = nubes_postgres_user.crud_user_0.username
pg_pass = jsondecode(nubes_postgres.npg_lucee.vault_secrets["users"]).user4crudpg.password
pg_db = nubes_postgres_database.pg_db.db_name
}
resource "nubes_lucee" "applucee" {
resource_name = "luceeresource"
startup_configuration = {
resource_realm = var.realm
}
cluster_configuration = {
cpu = 300
memory = 512
replicas = 1
}
access_configuration = {
domain = "tflucee"
}
app_configuration = {
version = "5.4"
git_path = "https://gitea.services.ngcloud.ru/Nail/tfluceecrud.git"
}
json_env = jsonencode({
TABLE_NAME = "check_point"
testds_class = "org.postgresql.Driver"
testds_bundleName = "org.postgresql.jdbc"
testds_bundleVersion = "42.6.0"
testds_connectionString = "jdbc:postgresql://${local.pg_host}:5432/${local.pg_db}"
testds_username = local.pg_user
testds_password = local.pg_pass
testds_connectionLimit = "5"
testds_liveTimeout = "15"
testds_validate = "false"
PGHOST = local.pg_host
PGPORT = "5432"
PGUSER = local.pg_user
PGPASSWORD = local.pg_pass
PGSSLMODE = "require"
DATABASE_URL = format(
"postgresql://%s:%s@%s:5432/%s",
local.pg_user,
local.pg_pass,
local.pg_host,
local.pg_db
)
})
depends_on = [nubes_postgres.npg_lucee]
}
-50
View File
@@ -1,50 +0,0 @@
resource "nubes_lucee" "app1" {
resource_name = "lucy_0"
startup_configuration = {
resource_realm = var.realm
}
cluster_configuration = {
cpu = 300
memory = 512
replicas = 1
}
access_configuration = {
domain = "tflucee"
}
app_configuration = {
version = "5.4"
git_path = "https://github.com/xahys/testlucee"
}
json_env = jsonencode({
# 🔗 Настройки Data Source 'testds' для Lucee (Application.cfc)
testds_class = "org.postgresql.Driver"
testds_bundleName = "org.postgresql.jdbc"
testds_bundleVersion = "42.6.0"
testds_connectionString = "jdbc:postgresql://${nubes_postgres.npg_lucee.state_out_flat["internalConnect.master"]}:5432/postgres"
testds_username = nubes_postgres.npg_lucee.vault_secrets["adminUser"]
testds_password = nubes_postgres.npg_lucee.vault_secrets["adminPass"]
testds_connectionLimit = "5"
testds_liveTimeout = "15"
testds_validate = "false"
# 🐘 Переменные окружения для Lucee (доступны через GetEnv)
PGHOST = nubes_postgres.npg_lucee.state_out_flat["internalConnect.master"]
PGPORT = "5432"
PGUSER = nubes_postgres.npg_lucee.vault_secrets["adminUser"]
PGPASSWORD = nubes_postgres.npg_lucee.vault_secrets["adminPass"]
PGSSLMODE = "require"
DATABASE_URL = format(
"postgresql://%s:%s@%s:5432/postgres",
nubes_postgres.npg_lucee.vault_secrets["adminUser"],
nubes_postgres.npg_lucee.vault_secrets["adminPass"],
nubes_postgres.npg_lucee.state_out_flat["internalConnect.master"]
)
})
depends_on = [nubes_postgres.npg_lucee]
}
+1 -1
View File
@@ -2,7 +2,7 @@ terraform {
required_providers {
nubes = {
source = "registry.kube5s.ru/nubes-test/nubes"
version = "5.1.10"
version = "5.1.12"
}
}
}
+17
View File
@@ -0,0 +1,17 @@
# =============================================================================
# PostgreSQL — пользователи (6 шт.)
# =============================================================================
resource "nubes_postgres_user" "crud_user_0" {
postgres_id = nubes_postgres.npg_lucee.id
username = "user4crudpg"
role = "ddl_user"
adopt_existing_on_create = true
}
resource "nubes_postgres_database" "pg_db" {
postgres_id = nubes_postgres.npg_lucee.id
db_name = "db4crudpg"
db_owner = nubes_postgres_user.crud_user_0.username
adopt_existing_on_create = true
}
Submodule
+1
Submodule tfluceecrud added at d623f21cd3