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

terraform fmt should allow disabling "align equals signs" #36795

Open
jameshfisher opened this issue Mar 28, 2025 · 2 comments
Open

terraform fmt should allow disabling "align equals signs" #36795

jameshfisher opened this issue Mar 28, 2025 · 2 comments
Labels
enhancement new new issue not yet triaged

Comments

@jameshfisher
Copy link

Terraform Version

Terraform v1.8.5
on darwin_arm64

Use Cases

  • git diff should only show the relevant changes to .tf files
  • .tf files should be readable; I should not need to put a ruler against the screen to see the value for a given argument

Attempted Solutions

I tried reading the docs: https://developer.hashicorp.com/terraform/cli/commands/fmt

Proposal

terraform fmt should allow disabling the current behavior which aligns = on multiple lines.
This is the expected format:

module "foo" {
  bar = "baz"
  qux = 42
  some_very_long_property_name_goes_here = "string"
}

This is the unexpected current behavior:

module "foo" {
  bar                                    = "baz"
  qux                                    = 42
  some_very_long_property_name_goes_here = "string"
}

References

http://github.com/hashicorp/terraform/issues/33281 but it was closed; I still have this problem

@jameshfisher jameshfisher added enhancement new new issue not yet triaged labels Mar 28, 2025
@crw
Copy link
Contributor

crw commented Mar 28, 2025

Thanks for this feature request! If you are viewing this issue and would like to indicate your interest, please use the 👍 reaction on the issue description to upvote this issue. We also welcome additional use case descriptions. Thanks again!

@wyardley
Copy link

wyardley commented Apr 1, 2025

Not sure if it helps for your use case, but note that you can work around this somewhat it by adding an empty line before the really long attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

3 participants