Skip to content

cdktf: using fullSynth while testing returns invalid JSON #3874

Open
@jheck-abs

Description

@jheck-abs

Expected Behavior

When testing with Jest and TypeScript the fullSynth method should returns the full synthesized version of the given stack.

Actual Behavior

The fullSynth method returns an erroneous JSON.

"cloudfoundry": [
      {
        "api_url": "${jsondecode(data.btp_subaccount_environment_instance.subaccount-environment-instance.labels)[\\"API Endpoint\\"]}",
        "origin": "btpDeploymentUserOrigin",
        "password": "btpDeploymentUserSecret",
        "user": "btpDeploymentUser"
      }
    ]

Above you can see that in api_url the double quotes are escaped twice, this breaks the JSON syntax.

Steps to Reproduce

The bug can be reproduced in the following repo:
https://github.com/jheck-abs/terraform-testing

Versions

language: typescript
cdktf-cli: 0.20.12
node: v20.11.0
cdktf: 0.20.12
constructs: 10.4.2
jsii: null
terraform: 1.11.4
arch: x64
os: win32 10.0.26100

Providers

Image

Gist

https://github.com/jheck-abs/terraform-testing

Possible Solutions

currently none

Workarounds

currently none

Anything Else?

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnewUn-triaged issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions