hashicorp / hashicorp/consul-template

toTOML incorrectly renders nested tables.

Open
#1,849 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
4.8k
Forks
801
Avg merge
4h 5m
Merged PRs (30d)
6

Description

When using toTOML function when rendering secrets that were stored in vault when transforming the map to TOML it incorrectly renders the nested tables.

Take this as example.

The original data stored in vault:
```
{
"metrics": {
"prometheus": {
"enabled": true
}
}
}
```

Using this template:
```
{{ with secret "secrets/staging/service.toml" -}}
{{ .Data.data | toTOML }}
{{- end }}
```

Renders:
```
[metrics]
[metrics.prometheus]
enabled = true
```

The spec for TOML states that nested tables should be [x.y] I don't understand what's the problem.

Contributor guide

Open the contributing guide

Research direction

Start by locating the toTOML template function and reproduce the nested-table example from the issue. Compare its rendered output with the TOML specification and establish the expected nesting syntax; done means the example renders valid nested tables without changing unrelated output.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.