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

Backport of command/format: Correctly quote diff object keys into v1.1 #30784

Conversation

teamterraform
Copy link
Contributor

Backport

This PR is auto-generated from #30766 to be assessed for backporting due to the inclusion of the label 1.1-backport.

The below text is copied from the body of the original PR.


This is a port of #25443 to the new diff renderer.

Fixes #21749

When rendering a diff, we should quote object attribute names if the string representation is not a valid identifier. While this is not
strictly necessary, it makes the diff output more closely resemble the configuration language, which is less confusing.

This commit applies to both top-level schema attributes and any object value attributes. We use a simplistic "%q" Go format string to quote the strings, which is not strictly identical to HCL's quoting requirements,but is the pattern used elsewhere in HCL and Terraform.

@teamterraform teamterraform force-pushed the backport/kmoe/diff-renderer-invalid-identifier/briefly-primary-porpoise branch from 9be8e7f to 51a0e67 Compare April 1, 2022 09:09
@teamterraform teamterraform requested a review from kmoe April 1, 2022 09:09
@kmoe kmoe merged commit 10502ec into v1.1 Apr 1, 2022
@kmoe kmoe deleted the backport/kmoe/diff-renderer-invalid-identifier/briefly-primary-porpoise branch April 1, 2022 09:16
@github-actions
Copy link

github-actions bot commented May 2, 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 contributions.
If you have 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 May 2, 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.

None yet

3 participants