!version
Use !version to read a locked version from the active Atmos version track.
The !version YAML function resolves a name from versions.lock.yaml. It uses the stack's asserted version.track, then version.track from atmos.yaml, then default.
!version is a stack-manifest function — it only resolves inside stack configuration files (stacks/**), not in atmos.yaml itself. atmos.yaml is only consulted as a source for version.track; it isn't processed by the same YAML-function evaluator, so !version there fails with an unsupported-tag error.
Usage
!version <name>
Example
Use !version in a stack manifest when the whole value is the version:
- Terraform
- Helm
version:
track: prod
components:
terraform:
datadog-forwarder:
dependencies:
tools:
opentofu: !version opentofu
vars:
image:
tag: !version dd_forwarder
With this lock file:
version: 1
tracks:
prod:
opentofu:
version: 1.10.6
dd_forwarder:
version: 5.4.5
Atmos resolves:
dependencies:
tools:
opentofu: 1.10.6
vars:
image:
tag: 5.4.5
components.helm.<name>.version is a top-level field, so a Helm chart version resolves the same way:
version:
track: prod
components:
helm:
monitoring:
chart: prometheus-community/kube-prometheus-stack
version: !version prometheus_chart
With this lock file:
version: 1
tracks:
prod:
prometheus_chart:
version: 65.1.1
Atmos resolves:
version: "65.1.1"
Embedded Strings
Use {{ .version.name }} when the version is part of a larger string:
- Terraform
- Container
vars:
image:
uri: "public.ecr.aws/datadog/lambda-extension:{{ .version.dd_forwarder }}"
Container components use a first-class image field (not nested under vars), and it holds the full repo:tag reference, so the version is embedded rather than assigned with !version:
components:
container:
api:
image: "localhost:5001/api:{{ .version.api_image }}"
Use !version when the whole value in a stack manifest is the version. Use {{ .version.name }} when the version is part of a larger string.
Pinned Entries
For entries with pin: digest (alias: sha) in their update policy, the two surfaces behave differently:
!version namealways returns the version (for example,v6.1.0) — never the digest.{{ .version.name }}emits the pinned form: the digest for pinned entries, the version otherwise. This is what rendered files and file managers embed.{{ .version.name.Version }}and{{ .version.name.Digest }}are individually addressable when you need one specific form:
vars:
image:
uri: "ghcr.io/example/app@{{ .version.app.Digest }}"
tag: "{{ .version.app.Version }}"