Skip to content

metalcloud-cli variable create

Create a new variable

Create a new variable with specified configuration.

This command creates a new variable using configuration provided through a JSON file or piped input. The configuration must include at minimum the variable name and value.

Required Flags: —config-source Source of the variable configuration data

Configuration Source Options: pipe Read configuration from stdin (use with echo or cat) /path/to/file Read configuration from specified JSON file

Configuration Format: The configuration must be valid JSON with the following structure: { “name”: “variable-name”, // Required: Variable name “value”: { // Required: Key-value pairs “key1”: “value1”, “key2”: “value2” }, “usage”: “general” // Optional: Usage type }

Required Permissions: VARIABLES_AND_SECRETS_WRITE

Examples:

metalcloud-cli variable create —config-source /path/to/config.json

echo ’{“name”:“my-var”,“value”:{“env”:“prod”,“region”:“us-east”}}’ | metalcloud-cli variable create —config-source pipe

cat my-variable.json | metalcloud-cli variable create —config-source pipe

metalcloud-cli var new —config-source /tmp/variable.json

metalcloud-cli variable create [flags]
--config-source string Source of the new variable configuration. Can be 'pipe' or path to a JSON file.
-h, --help help for create
-k, --api_key string MetalCloud API key
-c, --config string Config file path
-d, --debug Set to enable debug logging
-e, --endpoint string MetalCloud API endpoint
-f, --format string Output format. Supported values are 'text','csv','md','json','yaml'. (default "text")
-i, --insecure_skip_verify Set to allow insecure transport
-l, --log_file string Log file path
-v, --verbosity string Log level verbosity (default "INFO")

Auto generated by spf13/cobra on 11-Aug-2025

Section titled “Auto generated by spf13/cobra on 11-Aug-2025”