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
| Type | Description | Example Value |
|---|---|---|
percent | Percentage value | 80 |
count | Numeric count | 100 |
ip-netmask | IP address with netmask | 192.168.1.0/24 |
zone | Security zone name | trust |
ip-range | IP address range | 192.168.1.1-192.168.1.254 |
ip-wildcard | Wildcard IP pattern | 10.0.0.0/0.0.255.255 |
fqdn | Fully qualified domain name | dns.example.com |
port | Port number | 8080 |
egress-max | Maximum egress bandwidth | 1000 |
Set Variable
Create or update a variable.
Syntax
scm set setup variable NAME [OPTIONS]
Arguments
| Argument | Description | Required |
|---|---|---|
NAME | Variable name (must start with $) | Yes |
Options
| Option | Description | Required |
|---|---|---|
--type TEXT | Variable type | Yes |
--value TEXT | Variable value | Yes |
--folder TEXT | Folder scope | No* |
--snippet TEXT | Snippet scope | No* |
--device TEXT | Device scope | No* |
--description TEXT | Description | No |
* 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
| Argument | Description | Required |
|---|---|---|
NAME | Name of the variable to delete | Yes |
Options
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder scope | No* |
--snippet TEXT | Snippet scope | No* |
--device TEXT | Device scope | No* |
--force | Skip confirmation prompt | No |
* 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
| Option | Description | Required |
|---|---|---|
--file PATH | YAML file to load configurations from | Yes |
--dry-run | Simulate execution without applying changes | No |
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
| Argument | Description | Required |
|---|---|---|
NAME | Name of the variable to show; omit to list all | No |
Options
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder scope | No* |
--snippet TEXT | Snippet scope | No* |
--device TEXT | Device scope | No* |
--output, -o [table|json|yaml] | Output format (default: table) | No |
--max-results INTEGER | Maximum number of results to display | No |
* One of --folder, --snippet, or --device is required when listing variables.
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
| Option | Description | Required |
|---|---|---|
--folder TEXT | Folder scope | No* |
--snippet TEXT | Snippet scope | No* |
--device TEXT | Device scope | No* |
--file TEXT | Output filename for backup | No |
* 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
- Use the
$Prefix: Always prefix variable names with$as required by SCM convention. - Choose Correct Types: Select the variable type that matches the intended use to ensure proper validation.
- Scope Appropriately: Assign variables to the most specific container (folder, snippet, or device) needed.
- Add Descriptions: Include descriptions to document each variable's purpose for team members.
- Back Up Before Changes: Export your variables before making significant modifications.
- Use Dry Run for Bulk Imports: Preview bulk imports with
--dry-runbefore applying changes.