Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lib): escape newlines in terraform functions #1233

Merged
merged 5 commits into from
Nov 10, 2021

Conversation

DanielMSchmidt
Copy link
Contributor

@DanielMSchmidt DanielMSchmidt commented Oct 29, 2021

Previously newlines were added to the synthesised JSON, which JSON only accepts if escaped
This PR also escapes ${} into $${}

Closes #1165

@DanielMSchmidt DanielMSchmidt force-pushed the terraform-functions-should-escape-inputs branch 7 times, most recently from 06e5e7f to 2d82cd6 Compare November 1, 2021 13:22
DanielMSchmidt and others added 4 commits November 10, 2021 11:56
Previously newlines were added to the synthesised JSON, which JSON only accepts if escaped

Closes #1165
This might feel counter-intuitive but quotes are not required for an 'outer'
expression as the string will get quoted somewhere else already.
Only inner expressions need those extra quotes as they would else be treated
as raw expressions like e.g. `var.something`.
…l objects as inputs to functions)

This has previously only been done for objects but not for arrays.
@ansgarm ansgarm force-pushed the terraform-functions-should-escape-inputs branch from 5a48e5a to 99a2a32 Compare November 10, 2021 10:56
Copy link
Member

@ansgarm ansgarm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work 🎉
I added two commits (one fixing a thing for rawStrings and another one fixing a bug which existed before this PR) and rebased onto main

Copy link
Contributor

@skorfmann skorfmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@ansgarm ansgarm merged commit 62a85c8 into main Nov 10, 2021
@ansgarm ansgarm deleted the terraform-functions-should-escape-inputs branch November 10, 2021 12:48
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform functions don't properly escape inputs (e.g. containing newlines)
3 participants