`terraform fmt` question
- Dominant language
- Go
- Stars
- 5.8k
- Forks
- 657
- Avg merge
- 20h 36m
- Merged PRs (30d)
- 6
Description
An [issue's been opened on the Terraform repository](https://github.com/hashicorp/terraform/issues/13155) regarding the `terraform fmt` command, which after some tracing through comes into this repository.
### HCL Template
```hcl
# Global Variables
variable "account_number" {}
variable "active_region" {}
variable "aws_region" {}
variable "env_name" {}
```
### Expected behavior
What should have happened?
`terraform fmt` should be happy with this code block.
### Actual behavior
What actually happened?
`terraform fmt` resulted in the following:
```hcl
# Overall
variable "account_number" {}
variable "active_region" {}
variable "aws_region" {}
variable "env_name" {}
```
### Steps to reproduce
1. Add a single-line comment to the top of a block of similar variables
2. `terraform fmt`
### References
Are there any other GitHub issues (open or closed) that should
be linked here? For example:
- Original issue: https://github.com/hashicorp/terraform/issues/13155
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the formatting change from the HCL template in issue #191 and trace the `terraform fmt` path referenced by the linked Terraform issue. Compare the expected and actual output, then run the formatter's existing tests if you locate them. Done means the documented single-line comment and consecutive variables produce the intended formatting without an unwanted blank line.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100