Terraform: `terraform fmt` repeatedly indents some multiline comments

Created on 22 Nov 2016  ยท  3Comments  ยท  Source: hashicorp/terraform

Terraform Version

Terraform v0.7.11

Affected Resource(s)

None.

Terraform Configuration Files

resource "aws_security_group" "test" {
  /*ingress {
    protocol = "tcp"
    from_port = 80
    to_port = 80
    cidr_blocks = ["127.0.0.1/32"]
  }*/
}

Debug Output

https://gist.github.com/michaelkaye/6b9ee87e9a610e69f6061572ab034344

Expected Behavior

One run of terraform fmt should format the file, repeated runs on a formatted file should not keep changing it.

Actual Behavior

Each run of terraform fmt indents the contents of the comment block by an additional 2 spaces.

Steps to Reproduce

  1. terraform fmt (multiple times on the same file, such as an a automated linting script or commit checker should do)

References

https://github.com/hashicorp/terraform/issues/9859 - possibly a similar issue with multi-line strings

bug core

Most helpful comment

This problem seems to still exist for other kinds of multiline comments on Terraform 0.8.8:

example

In this example, I have an Atom plugin to run terraform fmt on every save.

All 3 comments

This is fixed in 0.8, try the beta!

This problem seems to still exist for other kinds of multiline comments on Terraform 0.8.8:

example

In this example, I have an Atom plugin to run terraform fmt on every save.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings