Skip to main content

Upgraded to Gomplate v5

· 4 min read
Erik Osterman
Founder @ Cloud Posse

Atmos now uses Gomplate v5, upgraded from v3. Most templates keep working unchanged. This post lists what still works with a warning, what changed and needs your attention, and how to report anything we missed.

Still works, with a warning​

Gomplate v5 removed the functions below. Atmos keeps them working through compatibility shims, so these templates do not break. Each use logs a warning that names the replacement. Please switch to the new name soon, because the shims will be removed in a future major release.

Old (still works)New
conv.Boolconv.ToBool
conv.Slicecoll.Slice
conv.Dictcoll.Dict
conv.Hascoll.Has
strings.Sortcoll.Sort
net.ParseIPnet.ParseAddr
net.ParseIPPrefixnet.ParsePrefix
net.ParseIPRangenet.ParseRange
splitN s sep nstrings.SplitN sep n s (input moves last)

When you switch the net functions, also check any method calls on the result. The new functions return different types, so a call such as .Contains or .Prior may need to change.

The short names slice, contains, hasPrefix, hasSuffix, split, and trim also keep working with no change needed. They come from Sprig, as before. If you turned Sprig off (templates.settings.sprig.enabled: false), Atmos provides them and logs a warning instead.

Changed, and you need to update your templates​

Atmos cannot restore the old behavior for these. Where it can detect the problem, it logs a warning, and the item below says so.

  • Bad numbers now fail. conv.ToInt64, conv.ToFloat64, and conv.Atoi return an error for non-numeric input instead of 0. If you relied on the 0, check the value first:

    retries: '{{ $r := conv.ToString (index .vars "retries") }}{{ if regexp.Match "^-?[0-9]+$" $r }}{{ conv.ToInt64 $r }}{{ else }}0{{ end }}'
  • Bad regular expressions fail with a clear error. An invalid regexp.* pattern used to crash Atmos. It now returns an error naming the template and the pattern.

  • Datasource directory URLs need a trailing slash. The second argument to datasource is now resolved like a relative link, so a directory URL must end in /. Atmos warns.

    url: "file:///configs/" # then (datasource "configs" "app.yaml") reads /configs/app.yaml
  • AWS Parameter Store (aws+smp://) no longer wraps values in .Value. Remove .Value, and add ?type=application/json to the URL if the parameter holds JSON. Atmos warns.

    # Before: '{{ (datasource "database").Value.host }}'
    db_host: '{{ (datasource "database").host }}'
  • BoltDB datasources are gone. Gomplate dropped them. Move that data to another datasource. Atmos warns.

  • env://NAME now fails. It always returned empty data. Use env:NAME or env:///NAME.

  • Vault KV v2: drop /data/ from the URL. Use .../kv/config, not .../kv/data/config, and read fields directly. The result no longer has the data and metadata wrapper.

  • Consul directory listings return a list of key names, not a map.

  • S3 rejects objects whose checksum does not match instead of returning them.

  • The global datasource timeout now applies everywhere. templates.settings.gomplate.timeout in atmos.yaml now applies to stacks that don't set their own. Those stacks previously used 5 seconds. If reads start timing out, raise the timeout.

  • Consul, Vault, SSM, and S3 send different requests. Strict access policies or proxies may need updating.

See the templates configuration reference and datasources reference for details.

Found something else?​

If a template that used to work now fails or renders a different value, and it is not listed here, open an issue with the template and the error or output. If we can restore compatibility, we will ship the fix in a patch release.

Why we upgraded​

Gomplate v3 and v4 depend on AWS SDK for Go v1, which is no longer supported. Its security findings (GO-2022-0635 and GO-2022-0646) cannot be fixed. Atmos never called the affected code, but scanners flagged it in every build. Gomplate v5 uses AWS SDK v2, so SDK v1 is now gone from Atmos. The same update also fixes two SSH denial-of-service advisories in Go's cryptography library (GO-2026-6354 and GO-2026-6355).

New in Gomplate v5​

  • coll.JQ runs a jq expression on a value.
  • tmpl.Inline and tmpl.Exec render nested templates.
  • semver.* parses and compares versions. Sprig, which is on by default, has its own semver function that hides this namespace. With Sprig on, compare versions with Sprig's {{ semverCompare ">= 1.5.0" .vars.version }}. With Sprig off (templates.settings.sprig.enabled: false), use {{ semver.CheckConstraint ">= 1.5.0" .vars.version }}. See the Gomplate semver reference.