Skip to content

Builder produces unquoted block labels which fails terraform fmt #297

@chanukov

Description

@chanukov

terraform fmt requires quoted labels in the latest v1.14.x, and this is intentional. HashiCorp explicitly closed issues requesting unquoted labels (#28689, #27313) as "working as intended." The Terraform language style guide mandates quoted labels as the canonical form, and no version from 1.5 through 1.15-rc2 has changed this.

Builder produces unquoted block labels (module foo {)
No existing option in FormatterOptions, DeserializerOptions, or SerializationOptions controls this
Workaround: pass pre-quoted strings as labels (['"foo"']), which works but is unintuitive
Suggested fix: a quote_block_labels option on FormatterOptions or even better make it the default, since terraform fmt is the de facto standard

Metadata

Metadata

Labels

builderIssue is related to creating HCL2 content with Builder classenhancementNew feature or requestworkaround-availableIssue can be solved by a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions