Skip to main content

Use variables

Depending on the action and/or operation you are defining in a flow, there are several ways you can add global and local variables to your flow.

Connection variables are available for action nodes and CLI nodes. When a node needs a cloud connection, choose a connection variable from the Connection variables section on the node's Connection tab (for action nodes) or directly in the Connection drop-down list (for CLI nodes). See Use a connection variable in an action node.

Add variables to parameters​

You can use variables in action nodes.

Note

Connection variables are not supported in node parameters.

  1. Add an action node to your flow (or edit an existing one).

  2. Depending on the parameters available for the action, select the plus (+) button next to the parameter where you want to add a variable.

  3. Select Variables and expand Global Variables or Local Variables, depending on your requirements, and select the variable you want.

    Add a variable as data

For parameters that expect a map (key-value structure), you can reference a variable or output from a previous node that contains the whole map. The flow uses the entire map at runtime, so you do not have to enter each key-value pair manually.

Use variables in Code and CLI nodes​

In Code nodes and CLI nodes, you can reference global and local variables directly in your script using a built-in variables object. This is useful when your script logic depends on values that are managed as flow variables, such as region names, thresholds, or feature flags.

  • Code node (JavaScript): Use $variables.globalVariables.<name> or $variables.localVariables.<name>.
  • Code node (Python): Use variables["globalVariables"]["<name>"] or variables["localVariables"]["<name>"].
  • CLI node: Use $variables.globalVariables.<name> or $variables.localVariables.<name>.

In Code nodes, $variables and $nodes are runtime objects in your script (flow data is loaded when execution starts). CloudFlow does not rewrite your source text, so values follow normal JavaScript or Python rules for strings, objects, and quoting. The Code node editor provides autocomplete suggestions for $nodes, variable scopes, and individual variable names.

In CLI nodes, your script is executed by the shell. CloudFlow processes $variables and $nodes using text injection before the command runs. Each value is automatically wrapped to handle spaces and special characters. Unlike in Code nodes, these references are not live objects. They are swapped for plain text. Be careful when adding your own quotes or backslashes, as they will wrap around CloudFlow's internal formatting and may cause parsing errors.

Note

Connection variables are not available using $variables. For CLI nodes, select a connection from the node's Connection drop-down list. You can pick a fixed connection or a connection variable. For Code nodes, pass the relevant values through a preceding node or a non-connection variable.

Add a connection variable in an action node​

A connection variable is a variable whose value is one of your organization's AWS or GCP connections. Action nodes and CLI nodes can use that variable instead of picking a connection separately on every node. You update the connection in one place, which makes flows easier to reuse across accounts or environments and saves you from editing each node when the target connection changes.

Note

Connection variables can be used in action nodes and CLI nodes. They are not available for use with other node types.

  1. Create a variable with Type connection.

  2. Add an action node to your flow (or edit an existing one).

  3. Select the node's Connection tab.

  4. Expand the Connection drop-down list. A Connection variables section is displayed.

    Add a connection variable to an action node

    The connections available match the action you are configuring. For example, for AWS actions only AWS connection variables are shown.

  5. Under Connection variables, select the global or local connection variable you want.

    A an action node with a selected connection variable

Add a connection variable in a CLI node​

You can also use connection variables in CLI nodes.

  1. Create a variable with Type connection.

  2. Add a CLI node to your flow (or edit an existing one).

  3. In Parameters, under Cloud connection provider, choose Google Cloud (GCP) or Amazon Web Services (AWS).

  4. Open the Connection drop-down list. The Connection drop-down list shows both connections and connection variables.

  5. Select the connection variable you want. At runtime, CloudFlow resolves the variable to its underlying connection ID. Updating the connection variable changes which connection the CLI node uses without editing the node itself.

Filter using variables​

You can filter on variables in a flow.

  1. Add a Filter node to your flow (or edit an existing one).

  2. Select +Add a new filter (or edit an existing one).

  3. Select the plus (+) button next to Value.

  4. Select Variables and expand Global Variables or Local Variables, depending on your requirements, and select the variable you want.

    Filter a variable

Add variables to messages​

If you have an action node that requires approval, you can add variables to the notification message that requests approval for an action.

  1. Add a node that requires approval to your flow (or edit an existing one).

  2. In Parameters, select Require approval for this action.

  3. In Message, enter your message. Whereever you want to add a variable, select the plus button (+).

  4. Select Variables and expand Global Variables or Local Variables, depending on your requirements, and select the variable you want to add to the message.

    Add a variable to a message