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: fixed defect with multiline tfvars not being escaped #631

Merged
merged 1 commit into from
Oct 27, 2023

Conversation

robbert229
Copy link
Contributor

This PR resolves #630 by using heredocs in variables when that variable includes a newline.

This PR isn't intended to fix all escaping with the WriteTerraformVars function, and there are other ways that this can be broken (for example using backspaces and double quotes within the value of the variable)

@@ -281,6 +281,15 @@ func WriteTerraformVars(dir string, vars []*Variable) error {
b.WriteString(" = ")
if v.HCL {
b.WriteString(v.Value)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we are using EOT as the base delimiter for the heredoc, and optionally adding extra Ts to it if the delimiter is already contained by the value.

@leg100 leg100 merged commit f35dffa into leg100:master Oct 27, 2023
5 checks passed
@leg100
Copy link
Owner

leg100 commented Oct 27, 2023

Thanks! Good point re double quotes, backspaces, etc. We'll tackle those another day.

leg100 added a commit that referenced this pull request Oct 27, 2023
🤖 I have created a release *beep* *boop*
---


## [0.1.15](v0.1.14...v0.1.15)
(2023-10-27)

### Features

* Implement TFE API for Team Tokens (#624) 1e4b173

### Bug Fixes

* fix local execution mode (#627) aefb365
* agent error reporting
([#628](#628))
([76e7dda](76e7dda))
* fixed defect with multiline tfvars not being escaped
([#631](#631))
([f35dffa](f35dffa))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Louis Garman <75728+leg100@users.noreply.github.com>
@robbert229 robbert229 deleted the bugfix/multiline-tfvars branch October 28, 2023 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

otf generated tfvars files don't support multiline strings
2 participants