metalcloud-cli secret create

Create a new secret

Synopsis

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:

Create a secret from JSON file

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

Create a secret from stdin (pipe)

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

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]

Options

      --config-source string   Source of the new secret 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

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