sless-examples/hello-node/job.tf
2026-03-09 17:57:29 +04:00

35 lines
969 B
HCL

# 2026-03-08 / Изменено: 2026-03-09
# job.tf — одноразовая функция: суммирует числа из переданного массива.
# Код: code/handler-job.js
resource "sless_function" "hello_job" {
name = "hello-job"
runtime = "nodejs20"
entrypoint = "handler-job.handle"
memory_mb = 128
timeout_sec = 30
source_dir = "${path.module}/code"
}
# Одноразовый запуск. Для повторного запуска увеличь run_id (1→2→3...).
resource "sless_job" "hello_run" {
name = "hello-run"
function = sless_function.hello_job.name
event_json = jsonencode({ numbers = [100, 200, 300] })
wait_timeout_sec = 600
run_id = 9
}
output "job_phase" {
value = sless_job.hello_run.phase
}
output "job_message" {
value = sless_job.hello_run.message
}
output "job_completion_time" {
value = sless_job.hello_run.completion_time
}