env
The env field exports environment variables to every step in a custom command. Values support Go templates, so they can be built from arguments, flags, and component configuration.
commands:
- name: provision
description: Provision a component
arguments:
- name: component
description: Name of the component
flags:
- name: stack
shorthand: s
description: Name of the stack
required: true
# ENV var values support Go templates
env:
- key: ATMOS_COMPONENT
value: "{{ .Arguments.component }}"
- key: ATMOS_STACK
value: "{{ .Flags.stack }}"
steps:
- atmos terraform plan $ATMOS_COMPONENT -s $ATMOS_STACK
- atmos terraform apply $ATMOS_COMPONENT -s $ATMOS_STACK
The variables are exported as real environment variables, so steps (and any scripts they invoke) read them with the usual $NAME syntax.
Fields
key- Required. Environment variable name.
value- Static or templated value. Supports Go templates such as
{{ .Arguments.* }},{{ .Flags.* }}, and{{ .ComponentConfig.* }}. valueCommand- A command whose stdout becomes the variable's value. Use either
valueorvalueCommand, not both.
tip
For secrets, prefer a custom component type with an env
section sourced from !secret, rather than inlining secret values into
value.