Skip to main content
Version: 5.x

Fixed Variables

You can specify fixed variables with the value field. This cannot be used together with default in a single variable definition.

images:
database:
image: "mysql:${MYSQL_VERSION}"
vars:
- name: MYSQL_VERSION
value: "5.5"
- name: NAMESPACE
value: ${devspace.namespace}-suffix
# If you set 'default: my-value' and 'source: none' will be
# internally converted to 'value: my-value'.
# Both variable definitions below are handled exactly the same
- name: SOURCE_NONE
default: my-value
source: none
- name: SOURCE_NONE
value: my-value
OVERWRITING

If you want to overwrite a fixed variable, you can use the --var FIXED=new-value flag

Configuration

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.

value

The value option expects a string, integer or boolean defining the value for the variable. You can also use other variables in a 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

alwaysResolve

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.:

devspace.yaml:

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

command.txt:

echo Hello ${my-var}!