terraform
terraform copied to clipboard
Terraform fmt not enforcing convention with respect to dangling commas.
Hi,
I have noticed that terraform fmt does not enforce a convention with respect dangling commas. For example:
variable "some_variable" {
description = "Some description."
type = list(string)
default = [
"some.string",
"some.string",
]
}
and
variable "some_variable" {
description = "Some description."
type = list(string)
default = [
"some.string",
"some.string"
]
}
Are both acceptable.
It would be good to enforce the dangling comma convention in this case.
Terraform Version
Terraform v0.12.26
+ provider.google v3.25.0
+ provider.google-beta v3.25.0
+ provider.null v2.1.2
+ provider.random v2.2.1
References
https://github.com/terraform-google-modules/terraform-google-bootstrap/issues/36 https://medium.com/@nikgraf/why-you-should-enforce-dangling-commas-for-multiline-statements-d034c98e36f8
I think this is a bug: back in 2018 the dangling comma being enforced was "decided to be a feature" and it looks like it's no longer working: https://github.com/hashicorp/terraform/issues/13025
bump ..