-
-
Notifications
You must be signed in to change notification settings - Fork 148
Description
Bug Report: Regression in v1.210.0 - YAML functions not processed when hydrating hooks
Describe the Bug
Starting in atmos v1.210.0, YAML functions are no longer processed when hydrating and running hooks. This causes !template functions to be treated as literal strings rather than being evaluated.
When using !template in hook configuration, the literal string !template <value> is returned instead of the evaluated template result, causing errors like:
Error: store "!template staging" not found in configuration
Expected Behavior
The !template YAML function should be processed during hook hydration, evaluating the template expression and returning the result (e.g., staging instead of !template staging).
This was the behavior in v1.209.0 and earlier versions.
Steps to Reproduce
- Create a stack configuration with a hook using
!template:
hooks:
store-outputs:
# Determine where we store outputs based on the project_id
name: !template "{{ index .settings.context.project_to_store .settings.context.project_id }}"-
Run atmos with the hook configuration in v1.210.0
-
Observe that
hooks.store-outputs.nameevaluates to!template staginginstead ofstaging -
To verify the issue, run:
atmos describe stacks -s stack --process-functions=false | \
yq '.["staging"].components.terraform["component"].hooks.store-outputs.name'Expected output: staging
Actual output in v1.210.0 when hooks are executed: !template staging
Environment
- Atmos version: v1.210.0 (regression from v1.209.0)
- The issue appears to be a deliberate change but causes breaking behavior
Additional Context
Regression diff: https://github.com/cloudposse/atmos/blame/7f1f92b3ea5c9adead7c76b7c1f390825c78397a/pkg/hooks/hooks.go#L40-L52
Workaround: Remove the !template function wrapper if the template expression already returns a string:
hooks:
store-outputs:
name: "{{ index .settings.context.project_to_store .settings.context.project_id }}"However, this represents a breaking change from previous versions and may affect other use cases where !template is necessary.
Impact: This blocked production deploys until the workaround was applied.
Related Discussion: This appears to be related to changes in how YAML functions are processed during hook hydration in v1.210.0.