Skip to content

terraform fmt should accept .tfbackend files #36564

Open
@thiagowfx

Description

@thiagowfx

Terraform Version

% terraform version
Terraform v1.10.4

Use Cases

It should be possible to run terraform fmt on .tfbackend files, just like it is possible to do so in .tfvars files.

As of now:

$ terraform fmt a.tfbackend
│ Error: Only .tf, .tfvars, and .tftest.hcl files can be processed with terraform fmt

Wherein:

$ cat a.tfbackend
a = "foo"
b      = "bar"

.tfbackend is very similar to .tfvars as per the official docs.

The example docs also show the files nicely formatted (the equal signs are vertically aligned), suggesting that it is the intent.

Attempted Solutions

terraform fmt a.tfbackend does not work.

Renaming it to a.tfvars and then running terraform fmt a.tfvars works.

Proposal

Make terraform fmt accept *.tfbackend files, similarly to .tfvars.

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions