# 2025-06-05 # notes.tf — CRUD функция для таблицы notes. # Роутинг по sub-path URL: # POST /fn/default/notes/add?title=...&body=... → INSERT записи # POST /fn/default/notes/update?id=1&title=...&body=... → UPDATE записи # POST /fn/default/notes/delete?id=1 → DELETE записи data "archive_file" "notes" { type = "zip" source_dir = "${path.module}/code/notes" output_path = "${path.module}/dist/notes.zip" } resource "sless_function" "notes" { namespace = "default" name = "notes" runtime = "python3.11" entrypoint = "handler.handle" memory_mb = 128 timeout_sec = 30 env_vars = { PG_DSN = var.pg_dsn } code_path = data.archive_file.notes.output_path code_hash = filesha256("${path.module}/code/notes/handler.py") } resource "sless_trigger" "notes_http" { namespace = "default" name = "notes-http" type = "http" function = sless_function.notes.name }