# 2026-03-07 # main.tf — e2e тест: hello-world функция на Node.js 20. # # Использование: # 1. terraform init && terraform apply # 2. После apply (~2 мин kaniko): # curl -s -X POST -H 'Content-Type: application/json' -d '{"name":"Naeel"}' # Ожидаемый ответ: {"message":"Hello, Naeel! (nodejs20)"} terraform { required_providers { sless = { source = "terra.k8c.ru/naeel/sless" version = "~> 0.1.1" } } } provider "sless" { endpoint = "https://sless-api.kube5s.ru" token = "dev-token-change-me" } resource "sless_function" "hello_node" { namespace = "default" name = "hello-node" runtime = "nodejs20" entrypoint = "handler.handle" memory_mb = 128 timeout_sec = 30 code_path = "${path.module}/handler.zip" code_hash = filemd5("${path.module}/handler.zip") } resource "sless_trigger" "hello_node_http" { namespace = "default" name = "hello-node-http" type = "http" function = sless_function.hello_node.name } output "trigger_url" { value = sless_trigger.hello_node_http.url }