49 lines
1.4 KiB
Terraform
49 lines
1.4 KiB
Terraform
# =============================================================================
|
|
# Node.js — CRUD (та же PG, та же таблица что у Lucee/Flask)
|
|
# =============================================================================
|
|
locals {
|
|
nodejs_pg_host = nubes_postgres.main_pg.state_out_flat["internalMaster"]
|
|
nodejs_pg_user = nubes_postgres_user.crud_user_0.username
|
|
nodejs_pg_pass = nonsensitive(jsondecode(nubes_postgres.main_pg.vault_secrets["users"]).user4crudpg.password)
|
|
nodejs_pg_db = nubes_postgres_database.pg_db.db_name
|
|
}
|
|
|
|
resource "nubes_nodejs" "appnodejs" {
|
|
resource_name = local.nodejs_resource_name
|
|
|
|
startup_configuration = {
|
|
resource_realm = var.realm
|
|
}
|
|
|
|
cluster_configuration = {
|
|
cpu = local.nodejs_cpu
|
|
memory = local.nodejs_memory
|
|
replicas = local.nodejs_replicas
|
|
}
|
|
|
|
access_configuration = {
|
|
domain = local.nodejs_domain
|
|
}
|
|
|
|
app_configuration = {
|
|
version = "22"
|
|
git_path = local.nodejs_git_path
|
|
health_path = "/"
|
|
}
|
|
|
|
git_revision = local.nodejs_git_revision
|
|
operation_timeout = local.nodejs_timeout
|
|
|
|
json_env = jsonencode({
|
|
TABLE_NAME = local.crud_table_name
|
|
PGHOST = local.nodejs_pg_host
|
|
PGPORT = local.pg_port
|
|
PGUSER = local.nodejs_pg_user
|
|
PGPASSWORD = local.nodejs_pg_pass
|
|
PGDATABASE = local.nodejs_pg_db
|
|
PGSSLMODE = local.pg_ssl_mode
|
|
})
|
|
|
|
depends_on = [nubes_postgres.main_pg]
|
|
}
|