Templates
Atmos supports Go templates in stack manifests, along with Sprig and Gomplate functions. Configure template processing and define datasources for dynamic configuration.
Configuration
Templates are configured in the templates section:
atmos.yaml
Settings
templates.settings.enabledA boolean flag to enable/disable the processing of Go templates in Atmos stack manifests. Defaults to
true. If set tofalse, Atmos will not process Go templates in stack manifests.templates.settings.sprig.enabledA boolean flag to enable/disable Sprig Functions in Atmos stack manifests. Defaults to
true.templates.settings.gomplate.enabledA boolean flag to enable/disable Gomplate Functions and Gomplate Datasources in Atmos stack manifests. Defaults to
true.templates.settings.gomplate.timeoutTimeout in seconds to execute Gomplate Datasources.
templates.settings.ignore_missing_template_valuesA boolean flag to globally ignore missing template values across all stack manifest imports. Defaults to
false. When set totrue, Atmos will not fail if a Go template variable is missing in any imported stack manifest — the missing variable will render as an empty string instead of producing an error. This is equivalent to settingignore_missing_template_values: trueon every individual import, but applied globally. The per-importignore_missing_template_valuessetting takes precedence and can be used to override the global default.This is especially useful when importing catalog manifests that use Go templates for external systems (e.g. Datadog) where not all template variables need to be provided by Atmos.
atmos.yamltemplates:
settings:
ignore_missing_template_values: true
Datasources
The templates.settings.gomplate.datasources setting is a map of Gomplate Datasource definitions:
- The keys of the map are the datasource names, which are used in Go templates in Atmos stack manifests
- The values of the map are the datasource definitions
Datasource Schema
Each datasource definition supports the following properties:
urlThe Datasource URL. Can be an HTTP URL, file path, or other supported URL schemes.
headersA map of HTTP request headers for the
httpdatasource. The keys of the map are the header names. The values of the map are lists of values for the header.
Using Datasources in Templates
terraform:
vars:
tags:
provisioned_by_ip: '{{ (datasource "ip").ip }}'
config1_tag: '{{ (datasource "config-1").tag }}'
config2_service_name: '{{ (datasource "config-2").service.name }}'
Available Template Functions
Atmos supports the following template functions and data sources:
- Go
text/templatefunctions - Atmos Template Functions
- Sprig Functions
- Gomplate Functions
- Gomplate Datasources
For more details, refer to Atmos Stack Manifest Templating
Function Conflicts
Some functions are present in both Sprig and Gomplate.
For example, the env function has the same name in Sprig and Gomplate, but has different syntax and accepts different numbers of arguments.
If you use the env function from one templating engine and enable both Sprig and Gomplate, it will be invalid in the other templating engine, and an error will be thrown.
For this reason, you can use the templates.settings.sprig.enabled and templates.settings.gomplate.enabled settings to selectively enable/disable the Sprig and Gomplate functions.
See Also
- CLI Configuration — Overview of CLI configuration
- Stack Manifest Templating — Complete guide to using templates in stacks
- Template Functions — Atmos-specific template functions