Leonardo Agueci
04/17/2026, 12:43 PMsettings:
templates:
settings:
gomplate:
datasources:
env:
url: "stacks/data/{{ .vars.environment }}.yaml"
And I use it as described in the documentation:
`ami: '{{{{ (index (datasource "env").ami .vars.aws_region) }}}}'`
It works great if aws_region contains directly a string value but is not working if it reference another variable, for example aws_region: {{ .vars.region }}
I have templates evaluation set to 3 and as far as I understood, in the first evaluation aws_region should be resolved to the actual value of region and ami to '{{ (index (datasource "env").ami .vars.aws_region) }}' so in the second evaluation it should be evaluated correctly with the value originally contained into region.
Am I assuming something wrong? Is there any way to make it works if I'm doing something wrong? Thanks in advanceErik Osterman (Cloud Posse)
04/19/2026, 2:30 AMErik Osterman (Cloud Posse)
04/19/2026, 2:30 AMLeonardo Agueci
04/20/2026, 7:06 AMaws_region:
'{{ if and .vars.disaster_recovery.enabled }}
{{- .vars.disaster_recovery.target_region -}}
{{ else }}
{{- .vars.disaster_recovery.original_region -}}
{{ end }}'
This works if I use aws_region with !terraform.state but not with datasources.