Regression in v1.210.0 - YAML functions not processed when hydrating hooks
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 134
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 ` 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
1. Create a stack configuration with a hook using `!template`:
```yaml
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 }}"
```
2. Run atmos with the hook configuration in v1.210.0
3. Observe that `hooks.store-outputs.name` evaluates to `!template staging` instead of `staging`
4. To verify the issue, run:
```bash
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:
```yaml
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.
Contributor guide
Assessment
This issue has not been assessed yet.