Skip to content

metalcloud-cli secret create

Create a new secret

Create a new encrypted secret for secure credential storage.

This command creates a new secret that will be encrypted and stored securely. The secret configuration must be provided through a JSON file or piped input.

Required Flags: —config-source Source of the secret configuration (required) Can be either ‘pipe’ for stdin input or a path to a JSON file

The configuration file must contain: name (string) The secret name (required) value (string) The secret value to encrypt (required) usage (string) The usage type (optional, defaults to “credential”)

Available usage types:

  • credential: For storing passwords, API keys, tokens
  • configuration: For storing configuration values
  • certificate: For storing SSL/TLS certificates
  • ssh_key: For storing SSH keys

Examples:

metalcloud-cli secret create —config-source ./my-secret.json

echo ’{“name”:“api-key”,“value”:“sk-1234567890”,“usage”:“credential”}’ | metalcloud-cli secret create —config-source pipe

Create from file with different usage type

Section titled “Create from file with different usage type”

metalcloud-cli secret create —config-source ./ssh-key.json

Example JSON configuration: { “name”: “database-password”, “value”: “super-secret-password”, “usage”: “credential” }

metalcloud-cli secret create [flags]
--config-source string Source of the new secret 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”