Skip to main content

Variable

Variables define reusable values scoped to folders, snippets, or devices in Strata Cloud Manager. Variable names must start with $. The scm CLI provides commands to create, update, delete, list, bulk import, and back up variables.

Overview

The variable commands allow you to:

  • Create variables with typed values scoped to a container
  • Update existing variable configurations
  • Delete variables that are no longer needed
  • Bulk import variables from YAML files
  • Export variables for backup or migration

Variable Types

TypeDescriptionExample Value
percentPercentage value80
countNumeric count100
ip-netmaskIP address with netmask192.168.1.0/24
zoneSecurity zone nametrust
ip-rangeIP address range192.168.1.1-192.168.1.254
ip-wildcardWildcard IP pattern10.0.0.0/0.0.255.255
fqdnFully qualified domain namedns.example.com
portPort number8080
egress-maxMaximum egress bandwidth1000

Set Variable

Create or update a variable.

Syntax

scm set setup variable NAME [OPTIONS]

Arguments

ArgumentDescriptionRequired
NAMEVariable name (must start with $)Yes

Options

OptionDescriptionRequired
--type TEXTVariable typeYes
--value TEXTVariable valueYes
--folder TEXTFolder scopeNo*
--snippet TEXTSnippet scopeNo*
--device TEXTDevice scopeNo*
--description TEXTDescriptionNo

* One of --folder, --snippet, or --device is required.

Examples

Create an Egress Max Variable

$ scm set setup variable "\$egress-max" \
--type egress-max \
--value 1000 \
--folder Texas
---> 100%
Created variable: $egress-max in folder Texas

Create an FQDN Variable in a Snippet

$ scm set setup variable "\$dns-server" \
--type fqdn \
--value dns.example.com \
--snippet "DNS-Config"
---> 100%
Created variable: $dns-server in snippet DNS-Config

Create a Variable with Description

$ scm set setup variable "\$web-port" \
--type port \
--value 8080 \
--folder Texas \
--description "Primary web server port"
---> 100%
Created variable: $web-port in folder Texas

Delete Variable

Delete a variable from SCM.

Syntax

scm delete setup variable NAME [OPTIONS]

Arguments

ArgumentDescriptionRequired
NAMEName of the variable to deleteYes

Options

OptionDescriptionRequired
--folder TEXTFolder scopeNo*
--snippet TEXTSnippet scopeNo*
--device TEXTDevice scopeNo*
--forceSkip confirmation promptNo

* One of --folder, --snippet, or --device is required.

Example

$ scm delete setup variable "\$egress-max" --folder Texas --force
---> 100%
Deleted variable: $egress-max from folder Texas

Load Variable

Load multiple variables from a YAML file.

Syntax

scm load setup variable [OPTIONS]

Options

OptionDescriptionRequired
--file PATHYAML file to load configurations fromYes
--dry-runSimulate execution without applying changesNo

YAML File Format

---
variables:
- name: "$egress-max"
type: egress-max
value: "1000"
folder: Texas
description: "Maximum egress bandwidth"

- name: "$dns-server"
type: fqdn
value: "dns.example.com"
snippet: "DNS-Config"

Examples

Load Variables from File

$ scm load setup variable --file variables.yaml
---> 100%
✓ Loaded variable: $egress-max
✓ Loaded variable: $dns-server

Processed 2 variables from variables.yaml

Dry Run

$ scm load setup variable --file variables.yaml --dry-run
---> 100%
Dry run mode: would apply the following configurations:
- name: $egress-max
type: egress-max
value: '1000'
folder: Texas
description: Maximum egress bandwidth
- name: $dns-server
type: fqdn
value: dns.example.com
snippet: DNS-Config

Show Variable

Display variable objects.

Syntax

scm show setup variable [NAME] [OPTIONS]

Arguments

ArgumentDescriptionRequired
NAMEName of the variable to show; omit to list allNo

Options

OptionDescriptionRequired
--folder TEXTFolder scopeNo*
--snippet TEXTSnippet scopeNo*
--device TEXTDevice scopeNo*
--output, -o [table|json|yaml]Output format (default: table)No
--max-results INTEGERMaximum number of results to displayNo

* One of --folder, --snippet, or --device is required when listing variables.

note

When no NAME is specified, all variables in the specified container are listed by default.

Examples

Show Specific Variable

$ scm show setup variable "\$egress-max" --folder Texas
---> 100%
Variable: $egress-max
================================================================================
Type: egress-max
Value: 1000
Folder: Texas

List All Variables in a Folder (Default Behavior)

$ scm show setup variable --folder Texas
---> 100%
Variables (3):
--------------------------------------------------------------------------------
Name: $egress-max
Type: egress-max
Value: 1000
--------------------------------------------------------------------------------
Name: $web-port
Type: port
Value: 8080
Description: Primary web server port
--------------------------------------------------------------------------------
Name: $dns-server
Type: fqdn
Value: dns.example.com
--------------------------------------------------------------------------------

Backup Variables

Backup variable objects from a specified location to a YAML file.

Syntax

scm backup setup variable [OPTIONS]

Options

OptionDescriptionRequired
--folder TEXTFolder scopeNo*
--snippet TEXTSnippet scopeNo*
--device TEXTDevice scopeNo*
--file TEXTOutput filename for backupNo

* One of --folder, --snippet, or --device is required.

Examples

Backup from Folder

$ scm backup setup variable --folder Texas
---> 100%
Successfully backed up 5 variables to variables_20240115_120530.yaml

Backup with Custom Filename

$ scm backup setup variable --folder Texas --file texas-variables.yaml
---> 100%
Successfully backed up 5 variables to texas-variables.yaml

Backup from Snippet

$ scm backup setup variable --snippet "DNS-Config"
---> 100%
Successfully backed up 2 variables to variables_20240115_120545.yaml

Best Practices

  1. Use the $ Prefix: Always prefix variable names with $ as required by SCM convention.
  2. Choose Correct Types: Select the variable type that matches the intended use to ensure proper validation.
  3. Scope Appropriately: Assign variables to the most specific container (folder, snippet, or device) needed.
  4. Add Descriptions: Include descriptions to document each variable's purpose for team members.
  5. Back Up Before Changes: Export your variables before making significant modifications.
  6. Use Dry Run for Bulk Imports: Preview bulk imports with --dry-run before applying changes.