CRUD: пример переведён на схему pg/ + apps/ (как в документации)
Раньше CRUD лежал плоской схемой (main.tf, locals.tf, postgres*.tf, три
приложения в одной папке) и версия провайдера в нём была 5.1.16 — из-за этого
опубликованная страница документации не могла ссылаться на этот репозиторий
(в ней описаны два каталога pg/ и apps/).
Что сделано:
- старые файлы плоской схемы удалены;
- добавлены pg/{main.tf,postgres.tf,postgres_user_db.tf,outputs.tf,
terraform.tfvars.example} и apps/{main.tf,locals.tf,lucee.tf,flask.tf,
nodejs.tf,.gitignore,terraform.tfvars.example} — из стенда TEST_STAND/CRUD;
- README.md — тот же пользовательский текст, но клонирование теперь
git clone https://gitea.services.ngcloud.ru/Nail/tf_examples.git && cd tf_examples/CRUD;
- провайдер в pg/main.tf и apps/main.tf: nubes-test/nubes 3.0.0.
Секреты не переносились: взяты только отслеживаемые git файлы стенда,
terraform.tfvars и apps/creds.json в репозиторий не попадали.
Проверено: 13 файлов в CRUD, .gitignore закрывает terraform.tfvars, creds.json,
tfstate.
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
# =============================================================================
|
||||
# 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]
|
||||
}
|
||||
Reference in New Issue
Block a user