Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configure variables and secrets

In STACKIT Functions you can configure environment variables for your function so that you can e.g. control the log verbosity of your function or submit some API URL.

Variables are always bound to a function revision and not to the function itself so that they can be added/updated/removed upon deploying new revisions. There are multiple supported ways on how you can submit variables to our backend when creating a function revision.


Prompt

By default if no value is provided the CLI is interactively asking you to provide a value for a variable. If you additionally use the --no-interactive flag, prompting will not work.

Fixed

If you do not need separate files for variables or have a non-sensitive variable which can be hardcoded you can also submit it as a fixed environment variable. Therefore you just assign a string value to the variable key in the revision.yaml:

    MYVAR: "VALUE"

Env

You can declare an environment variable to be read in from the environment:

export MY_VARIABLE=DATA

And then in the revision.yaml manifest file:

    MYVAR:
      env: MY_VARIABLE

Dotenv

You can provide environment variables via dotenv by declaring the local filesystems path to the file and the environment variable key, e.g. to my_secret_file in the workspace root:

MY_VARIABLE=DATA

And then in the revision.yaml manifest file:

    MYVAR:
      file: my_secret_file
      env: MY_VARIABLE

File

Another way of declaring a variable is by specifying a path to a file which exclusively contains the variables value, e.g. file_data in workspace root:

DATA

And then in the revision.yaml manifest file:

    MYVAR:
      file: file_data

Secret

In the near future we will also support references to a STACKIT Secrets Manager instance so that you can bring your own instance and safely store sensitive information there. This feature is work in progress!