Skip to content

cub attribute create

cub attribute create

Create a new attribute or bulk create attributes

Synopsis

Create a new attribute or bulk create multiple attributes by cloning existing ones.

SINGLE ATTRIBUTE CREATION:

Create a new attribute to register getter and setter functions for configuration paths.

ToolchainTypes:

  • Kubernetes/YAML: For Kubernetes YAML configurations

DataTypes:

  • string: String values
  • int: Integer values
  • bool: Boolean values

For complex attributes with ResourceTypePaths, use --filename to provide a YAML/JSON definition.

BULK ATTRIBUTE CREATION:

When no positional arguments are provided, bulk create mode is activated. This mode clones existing attributes based on filters and creates multiple new attributes with optional modifications.

Single Attribute Examples:

  # Create a simple attribute from a YAML file
  cub attribute create --space my-space --filename attr.yaml

  # Create a basic attribute with args
  cub attribute create --space my-space my-attr Kubernetes/YAML string --description "My attribute"

  # Create with allow-exists
  cub attribute create --space my-space --filename attr.yaml --allow-exists

Bulk Create Examples:

  # Clone all attributes matching a pattern with name prefixes
  cub attribute create --where "Slug LIKE 'app-%'" --name-prefix dev-,staging- --dest-space dev-space

  # Clone specific attributes to multiple spaces
  cub attribute create --attribute my-attr --dest-space dev-space,staging-space
cub attribute create [<slug> <toolchain-type> <data-type>] [flags]

Options

      --allow-exists          Allow creation of resources that already exist
      --annotation strings    annotations in key=value format; can separate by commas and/or use multiple instances of the flag
      --attribute strings     target specific attributes by slug or UUID for bulk create (can be repeated or comma-separated)
      --delete-gate strings   delete gates in key[=true] format; can separate by commas and/or use multiple instances of the flag
      --description string    Description for the attribute
      --dest-space strings    destination spaces for bulk create (can be repeated or comma-separated)
      --filename string       Read the ConfigHub entity JSON from file, URL (https://), or stdin (-); mutually exclusive with --from-stdin
      --filter string         Filter entity to apply to the list. Specify as 'space/filter' for cross-space filters or just 'filter' for current space. Supports both slugs and UUIDs. The filter will be combined with any --where clause using AND logic. Examples: "production-filters/security-check", "my-filter-uuid", "validation-rules"
      --filter-space string   filter entity containing WHERE expression to select destination spaces for bulk create (slug or UUID)
      --from-stdin            Read the ConfigHub entity JSON (e.g., retrieved with cub <entity> get --quiet --json) from stdin; merged with command arguments on create, and merged with command arguments and existing entity on update
  -h, --help                  help for create
      --jq string             jq expression, suppressing default output
      --json                  JSON output, suppressing default output
      --label strings         labels in key=value format; can separate by commas and/or use multiple instances of the flag
      --name-prefix strings   name prefixes for bulk create (can be repeated or comma-separated)
      --quiet                 No default output.
      --verbose               Detailed output, additive with default output
      --where string          Filter expression using SQL-inspired syntax. Supports conjunctions with AND. String operators: =, !=, <, >, <=, >=, LIKE, ILIKE, ~~, !~~, ~, ~*, !~, !~*. Pattern matching with LIKE/ILIKE uses % and _ wildcards. Regex operators (~, ~*, !~, !~*) support POSIX regular expressions. Examples: "Slug LIKE 'app-%'", "DisplayName ILIKE '%backend%'", "Slug ~ '^[a-z]+-[0-9]+$'"
      --where-space string    where expression to select destination spaces for bulk create
      --yaml                  YAML output, suppressing default output
      --yq string             yq expression, suppressing default output

Options inherited from parent commands

      --context string   The context to use for this command
      --debug            Debug output
      --space string     space ID to perform command on

SEE ALSO