terraform
terraform copied to clipboard
`terraform fmt` doesn't break long lines
Terraform Version
Terraform v0.12.7
Expected Behavior
Running terraform fmt on a file should break long lines. A reasonable number could be 120 chars. Or it should have the option to configure the amount of chars to break on.
Actual Behavior
Long lines are left intact.
anytime soon ?
I'm concerned that this would potentially cause very large diffs on other lines due to terraform insisting on adding non meaningful whitespace in front of =.
For example:
variable "foo" {
type = string
default = "A very long message that is reviewable in many PR tools and is reaching beyond the edge of many screens."
}
The default line is at 119 characters.
variable "foo" {
type = string
default = "A very long message that is reviewable in many PR tools and is reaching beyond the edge of many screens."
description = "Simple message."
}
Now we are at 123 characters, so it would need to be broken up.
I'm already very annoyed that PRs are now showing a diff for type and default which is a distraction, but now default itself becomes a multiline change, because some other line has changed. I know we can disable whitespace in most diff tools, but if the same PR has changes for python or yaml, disabling the whitespace diff is a very bad idea.
The example above is trivial but I had to deal with bunch of lines being re-aligned due to an other line being added/removed and this is a concrete issue.
It also makes the blame history much more verbose because we now have to sort out all the meaningless diffs when we want to track when a real value changed.
two years update, anytime soon?
No update. Please indicate your interest by adding a 👍 to the issue description. Thanks!
I think this would be a major improvement. I currently have formatting options set in my IDE but this feature would be useful