metalcloud-cli variable create¶
Create a new variable
Synopsis¶
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:
Create variable from JSON file¶
metalcloud-cli variable create –config-source /path/to/config.json
Create variable from stdin using pipe¶
echo ‘{“name”:”my-var”,”value”:{“env”:”prod”,”region”:”us-east”}}’ | metalcloud-cli variable create –config-source pipe
Create variable from file using cat¶
cat my-variable.json | metalcloud-cli variable create –config-source pipe
Using alias¶
metalcloud-cli var new –config-source /tmp/variable.json
metalcloud-cli variable create [flags]
Options¶
--config-source string Source of the new variable configuration. Can be 'pipe' or path to a JSON file.
-h, --help help for create
Options inherited from parent commands¶
-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")
SEE ALSO¶
metalcloud-cli variable - Manage variables for infrastructure configuration