cloudposse / cloudposse/atmos

a single ' causes atmos to error out when using !template tojson

Open
#1,250 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
1.4k
Forks
175
Avg merge
2d 3h
Merged PRs (30d)
134

Description

### Describe the Bug

have an atmos setup that uses !template toJson.

within my json, I have a single ' inside a specific json field.

![Image](https://github.com/user-attachments/assets/819430ae-8ee9-4912-8ed4-0391e2a7a1bf)

### Expected Behavior

atmos should be able to handle the json field to have ' with no issue.

![Image](https://github.com/user-attachments/assets/e23a612d-334d-4b9e-966c-58bf82eb388d)

### Steps to Reproduce

in stack, use _defaults.yaml
```yaml
settings:
templates:
settings:
gomplate:
timeout: 5
datasources:
vars_defaults:
url: "../../Variables/defaults.json"
```

in top level overrides.yaml, include
```yaml
vars:
bedrock_agent_configs: !template '{{ toJson (datasource "vars_merged_final").bedrock_agent_configs }}'
```

in enviornment level (dev), override.yaml:
```yaml
settings:
templates:
settings:
gomplate:
timeout: 5
datasources:
vars_environment:
url: ../../Variables/dev.json
vars_merged_final:
url: merge:vars_environment|vars_defaults
```

### Screenshots

_No response_

### Environment

OS: Window
version 26100.3915
module - n/a
terraform: 1.11.3

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with _defaults.yaml, top-level overrides.yaml, the dev environment override.yaml, and the !template toJson expression using the shown datasource configuration. Trace how the gomplate template processes the JSON field containing a single quote; done means the same configuration renders successfully without an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
terraform
Domain
cli, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.