examples/hello-node: move handler to code/, split http.tf and job.tf

This commit is contained in:
“Naeel”
2026-03-08 09:14:34 +04:00
parent 7f5a881c8a
commit 00cd3d181b
4 changed files with 80 additions and 46 deletions
+30
View File
@@ -0,0 +1,30 @@
# 2026-03-08
# http.tf — вариант с HTTP-триггером: постоянный эндпоинт, обрабатывает запросы.
#
# Использование:
# terraform apply
# curl -s -X POST $(terraform output -raw trigger_url) \
# -H 'Content-Type: application/json' -d '{"name":"Naeel"}'
resource "sless_function" "hello_http" {
namespace = "default"
name = "hello-http"
runtime = "nodejs20"
entrypoint = "handler.handle"
memory_mb = 128
timeout_sec = 30
code_path = data.archive_file.handler.output_path
code_hash = data.archive_file.handler.output_md5
}
resource "sless_trigger" "hello_http" {
namespace = "default"
name = "hello-http-trigger"
type = "http"
function = sless_function.hello_http.name
}
output "trigger_url" {
value = sless_trigger.hello_http.url
}