hashicorp / hashicorp/consul-template
[feature request] additional YAML helper functions
- Dominant language
- Go
- Stars
- 4.8k
- Forks
- 801
- Avg merge
- 4h 5m
- Merged PRs (30d)
- 6
Description
### Consul Template version
```
v0.35.0
actually used from Nomad template stanza
```
### Request
consul-template and places where it is used (like Nomad template stanza) have methods like `parseYAML`, `toYAML` etc. However a few are missing that could make this much more useful:
- `mergeYAML` -- merge 2 YAML objects allowing override leaf nodes of one with values of another. mergeMap[WithOverride] does not work here as YAML gets `map[inertface{}]interface{}`, but `explode` gets `map[string]interface{}`.
- `treeYAML` -- read KV tree as YAML object, where standard YAML type inference is used. `tree` can be read, but it assumes everything is a string, for example with KV tree like `config/app/key = 21` reading it as `{{ tree "config/app" | toYAML }}` will yield `key: "21"`, which obviously is not what would be expected.
Contributor guide
Research direction
Start by locating the existing parseYAML, toYAML, tree, mergeMap, and mergeMapWithOverride helpers in the Go codebase. Review how YAML values and KV trees are currently represented, then add focused coverage for the requested mergeYAML and treeYAML behavior; done means both helpers handle the examples in the request with tests covering type inference and overrides.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100