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

repl: Display multi-line strings as heredocs #27045

Merged
merged 1 commit into from
Nov 30, 2020
Merged

Conversation

alisdair
Copy link
Contributor

The console and output formatter previously displayed multi-line strings with escaped newlines, e.g. "hello\nworld\n". While this is a valid way to write the HCL string, it is not as common or as readable as using the heredoc syntax, e.g.

<<EOF
hello
world
EOF

This commit adds heredoc detection and display to this formatter, including support for indented heredocs for nested multi-line strings. This change affects the apply, console, and output sub-commands.

Fixes #27039. Targeting an 0.14.0 backport because this is a fairly narrowly-scoped fix to a problem introduced by changes in the 0.14 release.

The console and output formatter previously displayed multi-line strings
with escaped newlines, e.g. `"hello\nworld\n"`. While this is a valid
way to write the HCL string, it is not as common or as readable as using
the heredoc syntax, e.g.

<<EOF
hello
world
EOF

This commit adds heredoc detection and display to this formatter,
including support for indented heredocs for nested multi-line strings.
This change affects the apply, console, and output sub-commands.
@alisdair alisdair added cli 0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Nov 26, 2020
@alisdair alisdair added this to the v0.14.0 milestone Nov 26, 2020
@alisdair alisdair requested a review from a team November 26, 2020 16:46
@alisdair alisdair self-assigned this Nov 26, 2020
@codecov
Copy link

codecov bot commented Nov 26, 2020

Codecov Report

Merging #27045 (4e7607d) into master (111825d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted Files Coverage Δ
repl/format.go 99.05% <100.00%> (+0.29%) ⬆️
terraform/eval_diff.go 66.51% <0.00%> (-0.92%) ⬇️
terraform/node_resource_apply_instance.go 75.00% <0.00%> (-0.79%) ⬇️
terraform/evaluate.go 52.89% <0.00%> (-0.42%) ⬇️
states/statefile/version4.go 58.19% <0.00%> (+0.23%) ⬆️

Copy link
Contributor

@pselle pselle left a comment

Choose a reason for hiding this comment

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

🚀

@ghost
Copy link

ghost commented Dec 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.14-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v0.14.0-rc1 regression: Incorrectly rendered newlines in terraform output
2 participants