Skip to main content
Version: 5.x

Input-based Variables

If source: all (default) | input, DevSpace may ask the user a question to determine the value of a config variable.

image: "mysql:${MYSQL_VERSION}"
question: Which mysql version do you want to use?
default: "5.7"
Ignore Env Variables

If you want DevSpace to ignore environment variables, you can explicitly define source: input to make sure only explict user input will be used to set the value of the variable.

Variable Type

By default, the type (string, int, bool) of variable will be determined by the type of its default value (if defined) or automatically detected if no default value is defined. To explicitly use the value of a variable as a string, use $!{VAR_NAME} instead of ${VAR_NAME}.



The name option expects a string stating the name of the config variable that will be used to reference it within the remainder of the configuration.

Must be unique

The name of a config variable must be unique and is mandatory when defining a config variable.


The default option expects a string, integer or boolean defining the default value for the variable. You can also use other variables in a default value, with one of the following conditions being true:

  • The used variable is defined before the variable that wants to use it
  • The used variable is a predefined variable
Type Casting

If a default value is specified, DevSpace will assume the type of the default value as the type for the variable, i.e. when default: "123" is defined and a value of 123 (int) is provided it would be casted to "123" (string). To explicitly use the value of a variable as a string within devspace.yaml, use $!{VAR_NAME} instead of ${VAR_NAME}.


image: ${IMAGE}
default: myrepository
source: none
- name: IMAGE_NAME
default: devspace
source: none
- name: IMAGE
source: none
default: ${devspace.namespace}
source: none


The question option expects a string with a question that will be asked when the variable is not defined. DevSpace tries to resolve the variable according to the source of the variable and if it is not set via any of the accepted sources, DevSpace will prompt the user to define the value by entering a string.

  • Defining the question is optional but often helpful to provide a better usability for other users.
  • If valid options for the variable value are configured, DevSpace will show a picker/selector instead of a regular input field/prompt.
  • If a default value is configured for the variable, DevSpace will use this default value as default answer for the question that can be easily selected by pressing enter.

Default Value For question

question: Please enter a value for [VAR_NAME] # using the variable name


The options option expects an array of strings with each string stating a allowed value for the variable.

Example: Define Variable Options

- name: REGISTRY
question: Which registry do you want to push to?
source: input
- my.private-registry.tld
default: my.private-registry.tld

If the variable REGISTRY is used for the first time during devspace deploy, DevSpace will ask the user to select which value to use by showing this question:

Which registry do you want to push to? (Default: my.private-registry.tld)
Use the arrows UP/DOWN to select an option and ENTER to choose the selected option.
> my.private-registry.tld


The noCache option expects a boolean that disables the caching behavior for variables. When set to true, this will prompt the user on every run and will not save the value.

Default Value For noCache

noCache: false


The password option expects a boolean that defines if DevSpace should hide the user input when the user provides the value for this variable by entering a response to the question asked in the command line.

Default Value For password

password: false

Example: Hide User Response

question: "Please enter your registry token:"
source: input
password: true

If the variable REGISTRY_TOKEN is used for the first time during devspace deploy, DevSpace will ask the user to provide a value by showing this question:

? Please enter your registry token: *******

The response the user enters will be hidden as ******* to protect others from seeing the input while the user is typing.


The validationPattern option expects a string stating a regular expression that validates if the value entered by the user is allowed as a value for this variable.


If the provided value does not match the regex in validationPattern, DevSpace will either show a generic error message or the message provided in validationMessage.


The validationMessage option expects a string stating an error message that is shown to the user when providing a value for the variable that does not match the regex provided in validationPattern.


If enabled, the variable will be loaded even though it is not used within the config. This might be useful for variables that should be resolved after a config expression is applied. E.g.:


- name: my-var
value: my-value
alwaysResolve: true
- name: my-hook
command: $(cat command.txt)
events: ["after:deploy"]


echo Hello ${my-var}!