A function step is used to run an AWS Lambda-compatible function.

Important! Flowpipe function steps require Docker to be running. Make sure you have the Docker daemon installed and running.

Each step definition is a distinct instance of the step (a distinct container image); a looped step (via foreach) is ONE definition, but you cannot change the runtime or other container-specific settings in the loop.

pipeline "simple_pipe" {
param "event" {}
step "function" "my_func_defaults" {
source = "./my-other-function"
event = param.event


envMapOptionalA map of string to set environment variables
eventObjectOptionalJSON-compatible event object that contains data for a Lambda function to process
sourceStringRequiredPath to the function's deployment package within the local filesystem. The path is relative to the root of the mod (where the mod.hcl).
handlerStringOptionalFunction entry point in your code, in the format filename.functionname. If not specified default handler for the runtime is used (index.handler for nodejs, lambda_function.lambda_handler for python, etc.)
runtimeStringOptionalIdentifier of the function's runtime. Valid Values are nodejs:18, python:3.10.

This step also supports the common step arguments and attributes.

Attributes (Read-Only)

responseObjectThe response returned by the function

Names & Labels

Container names are randomly generated using standard docker names (elegant_sutherland, etc).

Image names are generated using the following format: flowpipe/{mod}.pipeline.{pipeline name}.function.{step name}:{timestamp}, e.g: flowpipe/test_suite_mod.pipeline.with_functions.function.hello_nodejs_step:20231012T155317200

Docker labels are automatically added to images & containers using the standard format, including the standard org.opencontainers labels, as well as Flowpipe-specific labels prefixed with io.flowpipe.

"Labels": {
"": "test_suite_mod.pipeline.with_functions.function.hello_nodejs_step",
"io.flowpipe.runtime": "nodejs:18",
"io.flowpipe.type": "function",
"org.opencontainers.container.created": "2023-10-12T04:29:32Z",
"org.opencontainers.image.created": "2023-10-12T04:29:29Z"

More Examples

pipeline "another_pipe" {
step "function" "my_func" {
# Now
description = "this is my function"
source = "./my-function"
runtime = "nodejs:18"
handler = "my_file.my_handler"
timeout = 10000
event = jsondecode(jsonencode({
"body":"{\n\"name\": \"bob\",\n\"tag\": \"hello\"\n}",
env = {
foo = "bar"
up = "down"