Comments in .tmpl are evaluated
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 175
- Avg merge
- 2d 25m
- Merged PRs (30d)
- 143
Description
### Describe the Bug
Atmos version `v1.195.0`.
This new version caught an error in one of my `.tmpl` files that previous versions missed - so far, so good.
However, after commenting out the problematic line, it still reports the same error. It only stops complaining once the line is completely removed.
### `catalog/qh/di/aws-tgw-attachment/secondary.yaml.tmpl`
```shell
components:
terraform:
"tgw-attachment/{{ .name }}":
metadata:
component: cloudposse/aws-tgw-attachment
vars:
name: "{{ .name }}"
vpc_component_name: "vpc/{{ .name }}"
transit_gateway_id: !terraform.state tgw-hub transit_gateway_id
transit_gateway_route_table_id: !terraform.state tgw-hub transit_gateway_route_table_id
# transit_gateway_attachment_subnet_name: '{{ default "" .transit_gateway_attachment_subnet_name }}'
```
### The error
```shell
Executing command: `atmos terraform deploy cloudposse/aws-team-roles -s core-gbl-root`
Error
invalid stack manifest: template: catalog/qh/di/aws-tgw-attachment/secondary.yaml.tmpl:11:65: executing "catalog/qh/di/aws-tgw-attachment/secondary.yaml.tmpl" at <.transit_gateway_attachment_subnet_name>: map has no entry for key "transit_gateway_attachment_subnet_name"
File being processed: catalog/qh/di/aws-tgw-attachment/secondary.yaml.tmpl
Import chain:
→ orgs/qh/prod/sanofi/eu-west-3/network.yaml
→ catalog/qh/di/network-secondary.yaml
→ catalog/qh/di/aws-tgw-attachment/secondary.yaml.tmpl
stack manifest 'catalog/qh/di/aws-tgw-attachment/secondary.yaml.tmpl'
```
### Expected Behavior
Ignore comments.
### Steps to Reproduce
Provided above.
### Screenshots
_No response_
### Environment
_No response_
### Additional Context
_No response_
Contributor guide
Research direction
Start by reproducing the error with catalog/qh/di/aws-tgw-attachment/secondary.yaml.tmpl and trace how Atmos processes the .tmpl file during the shown terraform deploy command. Verify that the commented template expression is ignored and that the deployment no longer reports the missing transit_gateway_attachment_subnet_name key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, terraform
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100